79423805

Date: 2025-02-08 19:38:35
Score: 0.5
Natty:
Report link

The answer by @Sven is correct. Although, more resources / links can be referenced to get an overall idea about the reasoning.

Follow these steps to get Hibernate running with Spring 6.x (I used 6.2):

  1. Although one might be able to work with other Hibernate versions, it is recommended to use Hibernate >= 5.16. Refer the Spring ORM documentation for details.
  2. Use following dependencies in pom.xml:
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core-jakarta</artifactId>
        <version>5.6.15.Final</version>
    </dependency>
    <dependency>
        <groupId>jakarta.persistence</groupId>
        <artifactId>jakarta.persistence-api</artifactId>
        <version>3.0.0</version>
    </dependency>
    <dependency>
        <groupId>jakarta.transaction</groupId>
        <artifactId>jakarta.transaction-api</artifactId>
        <version>2.0.1</version>
    </dependency>
    
    Note: Hibernate 5.16 can only work in the jakarta namespace. That is why a different artifact hibernate-core-jakarta is used instead of the usual hibernate-core to make it work with Spring 6.x. For details, refer to the following links:
    1. Stackoverflow question
    2. GitHub issue - 1
    3. GitHub issue - 2
Reasons:
  • Blacklisted phrase (1): Stackoverflow
  • Long answer (-1):
  • Has code block (-0.5):
  • User mentioned (1): @Sven
Posted by: Python_user