Switching from version 4.3.11. Final at 5.0.1. Error of source compilation reason

I am trying to upgrade a version of Hibernate with

<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>4.3.11.Final</version> </dependency> 

to

 <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>5.0.1.Final</version> </dependency> 

Unfortunately, when compiling, I get the following error.

TestDao.java: [5.25] cannot find character

Symbol [ERROR]: Transactional class

[ERROR] location: javax.transaction package

I struggled with this for more than an hour.

I tried to add the spring-tx package, but that did not help.

 <dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> <version>4.2.1.RELEASE</version> </dependency> 

Has anyone encountered a similar problem?

+6
source share
1 answer

spring-tx gives you org.springframework.transaction.annotation.Transactional , but your error message clearly states that you are trying to apply javax.transaction.Transactional .

A search for javax.transaction.Transactional in the Center shows several candidates; either javax.transaction:javax.transaction-api:1.2 , or javax:javaee-api:7.0 looks like a reasonable option.

It seems that the POM for Hibernate 4.3 included a dependency on the JBoss-specific javax.transaction package version, but it was removed in Hibernate 5.0, presumably because it was standardized and included a hard dependency on a specific package, it could lead to runtime problems .

+4
source

All Articles