I was following a tutorial to get start with Hibernate, there a note given to add Hibernate artifact id as
<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate</artifactId> <version>3.2.3.ga</version> </dependency>
and with it lot of other dependency like , dom4j, javax.transaction (JTA) etc..
but the latest hibernate version is "4.3.5.Final"(gathered from hibernate.org), and artifact id given there was :
<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>4.3.5.Final</version> </dependency>
with no extra dependencies to add in pom.xml of my sample
When I compiled my project with tutorial way, in my .m2 directory org.hibernate got created and it has everything which is needed for sample to run.
I deleted everything in repo and compiled only using hibenate-core (given on hibernate.org), all the necessary things were downloaded and sample ran successfully with this too.
I tried to see the
pom.xml of the hibernate-core in .m2, and noticed that dependencies for things like dom4j and transactions are added here. (hence may be no need to add in sample's pom.xml). Also noticed that the trasaction API are now used form Jboss.spec.javax.
I am confused that, what is the correct way? Is hibernate-core is the latest way of doing things? and what are the differences with "hibernate" artifact? Why things like transaction API implementation is changed from
java.transaction to org.jboss.spec.javax.transaction?
Where can I find these things in details?
As of hibernate 4 the maven artifacts are separated into separate modules instead of a single jar. The recommended way as of hibernate 4 is to use <strong>hibernate-core</strong> artifact. Please read section 1.1.1 on the manual: http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html_single/#tutorial-firstapp-setup