How to configure Hibernate 5 with Spring 4 How to configure Hibernate 5 with Spring 4 spring spring

How to configure Hibernate 5 with Spring 4


May be you should add

<dependency>  <groupId>javax.transaction</groupId>  <artifactId>jta</artifactId>  <version>1.1</version></dependency>

I had the same issue, and my initial logs complained about,

java.lang.NoClassDefFoundError: javax/transaction/SystemException


@sapna answer is working.

But for those curious about why it breaks between hibernate 5.0.3.Final and 5.0.4.Final, here is the answer : They removed the dependency on jta, which was :

<dependency>    <groupId>org.apache.geronimo.specs</groupId>    <artifactId>geronimo-jta_1.1_spec</artifactId>    <version>1.1.1</version>    <scope>compile</scope></dependency>

The change is described there : HHH-10178

So if you are upgrading from 5.0.x to 5.0.4 or 5.0.5 and wish to not change anything to your classpath, you should rather import this lib than the javax.transaction:jta one.

EDIT:they reverted this change with hibernte 5.0.7 : HHH-10307, so upgrading to this version or newer should also fix the issue.