I am starting working on my first JPA project and I will be using Hibernate. I have downloaded the hibernate-release-4.3.9.Final.zip file from http://hibernate.org/orm/downloads/ website which mentions that Hibernate 4.3.9.Final version supports JPA 2.1.
I have unzip this file and there are 35 Jar files in it. These are the locations of those 35 Jars:
1 Jar in lib\envers folder.
1 Jar in lib\jpa folder.
1 Jar in lib\jpa-metamodel-generator folder.
3 Jars in lib\optional\c3p0 folder.
3 Jars in lib\optional\ehcache folder.
9 Jars in lib\optional\infinispan folder.
2 Jars in lib\optional\proxool folder.
3 Jars in lib\osgi folder.
10 Jars in lib\required folder.
1 Jar in project\gradle\wrapper folder.
1 Jar in project\hibernate-osgi\src\test\resources\bnd folder.
My question is which Hibernate Jars are needed for JPA 2.1 support? I am sure that 1 Jar in lib\jpa folder is definitely needed. But what other Jars are needed?
Thanks
For Hibernate core with JPA 2.1 support the jars in required folder are alone enough:
From the maven repository :
The other jars as said are optional and can be added to the classpath on a need basis.For instance you want caching and want to use ehcache as your cache provider, then you can add ehcache jar to the classpath. Or c3p0 for connection pooling.
If you just need JPA with hibernate's implementation , then you need to have the following in your classpath:
DOC: http://docs.jboss.org/hibernate/stable/entitymanager/reference/en/html/pr01.html
Related
I am using Windows 10 and Netbeans 8.2. I am able to use JPA 2 with Hibenate 4.3.x. Actually Netbeans 8.2 comes with Hibernate 4.3.x. Now i want to use Hibernate 5.2.x. I have downloaded Hibernate 5.2.12 as zip file from this link http://hibernate.org/orm/releases/5.2/. Then i have imported it into Netbeans. But i am getting the error :
javax.persistence.PersistenceException: No Persistence provider for EntityManager.
I know it is easy to use with maven.
Finally i have got the solution.
If the zip folder unzipped and all the jars inside the required folder imported, it will not work. One of the following errors or both may shown :
No Persistence provider for EntityManager named
Hibernate 5.2.2: No Persistence provider for EntityManager
To solve the above problems have to do the following task :
This line have to add in the persistence.xml file :
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
And have to download classmate-0.8.0.jar, and have to add it in the class path. This jar can be downloaded from Here
Then have to download the hibernate-entitymanager-5.0.12.Final.jar file and Have to add it in the class path. The jar can be downloaded from Here
In the Netbeans there is a default library called Hibernate 4.3.x(JPA 2.1).If you want to change this library, you have to find the installation folder of Neatbeans and the folder where hibernate has kept.
In windows it may found in :
C:\Program Files\NetBeans 8.2\java\modules\ext\hibernate4
For Linux it may be found in :
/usr/local/netbeans-8.2/java/modules/ext/hibernate4/
Then paste the jars from required folder (It will be found in downloaded Hibernate folder) and other jars mentioned above. You may find some jars duplicate. Then you may notice that some jars of hibernate almost with the same name but difference in version. Then delete the jars which has older version name.
one of your dependency file is Zip file . Extract it and the add the Jar instead
I built my netbeans project and it created a .war file including all the .jar libraries. I need to remove my all libraries from .war file. I tried to untick them from library folder but then the project does not deployed. How can I remove my libraries from the .war file and if I remove them where should I put them correctly. In jboss also there is a folder called lib in standalone folder.Should I put them there? If so how to do it. I am not using maven.
If you are using Maven set the dependency scope to the libraries you would like omitted to have scope provided. You can add the dependencies of your WAR to the MANIFEST.MF file or the jboss-deployment-structure.xml file using Maven. If the lirbaries are not JBoss modules by default, eg Orcale JDBC driver, then you will need to create these modules yourself. See the JBoss AS 7 documentation on how to do this.
You can try following approach. I haven't worked on Jboss so don't have detail idea about it.
Deploy each logical library (like "OpenJPA" or "Log4J") as a module, including its api and impl jars and any dependency JARs that aren't already provided by other AS7 modules. If there's already a module add a dependency on it rather than adding a JAR to your module. If several different libraries share some common dependencies, split them out into modules and add them as module dependencies in module.xml.
Use jboss-deployment-structure.xml to have your deployment .war / .ear / whatever declare a dependency on the module if it isn't autodetected and autoloaded.
Courtesy #Craig Ringer.
For complete thread go here
I'm learning Hibernate and am following an online tutorial on integrating it with Eclipse. I have installed the JBoss plugin with Hibernate into Eclipse Luna 4.4. and verified I have Hibernate available. The next step is to configure the build path for my new Java project and include the "necessary" Hibernate libraries...no information given on how to do that. How does one go about identifying the required jar files? I see several folders under my eclipse plugins directory that contain jboss or hibernate in the folder name, and underneath these folders do exist jar files, but I would think that there must be an easier way than plodding through all these directories and adding any jar file that looks like it's related to Hibernate or JBoss. Thanks.
Right now, My project framework is Hibernate 3.6.5 now want to upgrade it to the latest one Hibernate 4.3.5.
There are some dependencies in between the .jar files.
My question is :
What all are the .jar files need to be change/replace at the time of upgrade ?
Recently I have the following .jar files for the Hibernate 3.6.5.
Here is the recent required .jars for the Hibernate 4.3.5.
Which .jar files are need to be replace ?
Thanks.
Download the latest version of Hibernate from the following Site http://hibernate.org/.
After downloading unzip the Downloaded Zip file. Now you can see mainly three folders like documentation, lib, project.
Open lib folder, now you can see following folders envers, jpa, optional, osgi, required.
Add all jar files (under required folder) to the classpath and also add one more jar file (under jpa).
===============================================
Assume you are downloaded Hibernate Software 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
until now am copying all of my dependency jars to WEB-INF/lib folder for web applications developing in eclipse, its complicated to identify those jars when it is more numbers. for example in an application with struts and hibernate frame works i am copying all jars of struts (more than 60 jars) and of hibernate (more than 15) directly to lib folder.
Question is : How i could group those jars as libraries under WEB-INF/lib folder ?
If it's just to keep an overview of all your libraries, you could consider organising them into User Libraries.
Another option (not for everyone) would be to have separate projects for each set of libraries (of course they'd need to export those and be included in dependent projects).