Search code examples
springhibernate

Is Spring 6 not working with Hibernate 5?


Trying to setup Spring 6 with Hibernate 5 is not working.

Using org.springframework.orm.hibernate5.LocalSessionFactoryBean which will try to setup org.springframework.orm.hibernate5.SpringSessionContext

In its Constructor: this.transactionManager = jtaPlatform.retrieveTransactionManager();

=> java.lang.NoSuchMethodError: 'jakarta.transaction.TransactionManager org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform.retrieveTransactionManager()'

The Spring hibernate5 packages should not use jakarta but javax packages, right?


Solution

  • According to https://github.com/spring-projects/spring-framework/issues/31039 answer, one should use hibernate-core-jakarta version.