10

I started to learn Hibernate framework from "Hibernate 3.2 in Simple Steps" book, but I downloaded latest version of Hibernate which is 4.1.9. According to the book there are many essential jars we need to add to the class path like

  • Anttr-2.7.6.jar
  • asm.jar
  • asm-attrs.jar
  • cglib-2.1.3.jar
  • commons-collections-2.1.1.jar
  • commons-logging-1.0.4.jar
  • . . . etc.

But I can't find all those required jars in new version. So what can I do without going for an old version ?? Do I just only need to add jars in required folder,,, can any one please tell me what jars I should need to add class path (4.1.9 version). This question may be silly but I'm a beginner and I'm stuck here. Please help me. Thank you!

Grant
  • 4,413
  • 18
  • 56
  • 82

5 Answers5

23
antlr-2.7.7.jar
commons-collections-3.2.1.jar
dom4j-1.6.1.jar
javassist-3.12.1.GA.jar
hibernate-core-4.0.1.Final.jar
hibernate-commons-annotations-4.0.1.Final.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
jboss-logging-3.1.0.CR2.jar
jboss-transaction-api_1.1_spec-1.0.0.Final.jar

The zip file which you download will have a required folder inside lib.It will be having all the necessary jars.

Renjith
  • 3,274
  • 19
  • 39
5

This is well explained in the Hibernate documentation (never just depend on a book when there's an abundance of good online material available, as is the case with Hibernate):

The lib/required/ directory contains all the JARs Hibernate requires. All the jars in this directory must also be included in your project's classpath.

All jars you need are right there, in the .zip file you already downloaded.

fvu
  • 32,488
  • 6
  • 61
  • 79
2

Assume you are downloaded Hibernate Software( http://hibernate.org/ ) following location.

Hibernate_HOME = /home/rangareddy/Hibernate/hibernate-release-4.2.7.Final

Jar files:

%Hibernate_HOME%/lib/required/antlr-2.7.7.jar
%Hibernate_HOME%/lib/required/dom4j-1.6.1.jar
%Hibernate_HOME%/lib/required/hibernate-commons-annotations-4.0.2.Final.jar
%Hibernate_HOME%/lib/required/hibernate-core-4.2.7.Final.jar
%Hibernate_HOME%/lib/required/hibernate-jpa-2.0-api-1.0.1.Final.jar
%Hibernate_HOME%/lib/required/javassist-3.18.1-GA.jar
%Hibernate_HOME%/lib/required/jboss-logging-3.1.0.GA.jar
%Hibernate_HOME%/lib/required/jboss-transaction-api_1.1_spec-1.0.1.Final.jar
%Hibernate_HOME%/lib/jpa/hibernate-entitymanager-4.2.7.Final.jar
Ranga Reddy
  • 2,936
  • 4
  • 29
  • 41
1

I'd suggest learn to use maven or gradle first and let them to help you set up the dependencies.

Using a dependency management tools in such days of java development is important and useful, all well known java libraries support this way and also it is recommanded.

A tech book may be outdated very soon, for such of this kind of details, the official doc would be always the first choice.

Strong Liu
  • 804
  • 7
  • 4
-1

in case of using maven add this code to your pom file

        <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>4.0.1.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>4.2.0.Final</version>
    </dependency>        
    <dependency>
        <groupId>org.hibernate.common</groupId>
        <artifactId>hibernate-commons-annotations</artifactId>
        <version>4.0.1.Final</version>
        <classifier>tests</classifier>
    </dependency>
    <dependency>
        <groupId>org.hibernate.javax.persistence</groupId>
        <artifactId>hibernate-jpa-2.0-api</artifactId>
        <version>1.0.1.Final</version>
    </dependency>      
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.0.1.Final</version>
    </dependency>       
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.6.4</version>
    </dependency>
    <dependency>
        <groupId>org.jboss.logging</groupId>
        <artifactId>jboss-logging</artifactId>
        <version>3.1.0.CR2</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.6.4</version>
    </dependency>
Atul Sharma
  • 41
  • 1
  • 6