0

I have a project with spring boot 3.1.0 that uses hibernate 6.6.2.
Because there are some errors in hibernate version 6.6.2 I (see org.hibernate.sql.ast.SqlTreeCreationException: Could not locate TableGroup - model.dao.User(1055362627602899)) would like to downgrade hibernate version to 5.6.x and keep spring boot version, until hopefully the problem will be fixed.
Is it possible to do this and how can I do it?

I'm using Maven, this is the relevant pom file

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.1.0</version>
</parent>
<dependencies>  
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-taglibs</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-logging</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.mariadb.jdbc</groupId>
            <artifactId>mariadb-java-client</artifactId>
        </dependency>
</dependencies>

Thank you!

Adrian
  • 101
  • 8
  • 1
    Most of the compatibility issues are found once you downgrade and run. You have to give it a try. – Nikolas Charalambidis May 24 '23 at 06:43
  • Hi Nikolas, thank you for your response, but how can I downgrade the hibernate version from spring boot to give a try? This was the question. Thank you! – Adrian May 24 '23 at 12:04
  • Exclude Hibernate from the POM and include your specific version (assuming you use Maven). – Nikolas Charalambidis May 24 '23 at 15:46
  • Hi Nikolas, thank you for your response. You are right, I'm using Maven. I have updated my answer with relevant pom file. Can you tell me in more details how to downgrade hibernate version? Thank you! – Adrian May 24 '23 at 19:20
  • I strongly doubt, you can (without *enourmous* effort): a quick try on `5.6.15.Final` ... will reveal, that hibernate "re-located" (maven) artifacts between 5-6 ...(and spring:6 followed up) – xerx593 May 24 '23 at 20:18
  • .. from "org.hibernate/hibernate-core" ..to "org.hibernate.orm/..." and that's only the first ("simple") hurdle – xerx593 May 24 '23 at 20:20
  • Even if the dependency hadn't be relocated, you will run afoul of the changes from JPA 2.x to 3.x and the accompanying namespace changed from `javax.persistence` to `jakarta.persistence`. And though Hibernate 5.6 has a Jakarta-variant, it is unlikely to work properly with Spring Boot 3 as it likely uses Hibernate 6 specific features. Trying to fix and address the errors you receive is probably a more productive avenue of investigation (or rolling back to Spring Boot 2.7). – Mark Rotteveel May 25 '23 at 11:03
  • Hi Mark & xerx593, you are both right, I've spent quite a time trying to replace different components and had all kinds of cascading errors. The original error that I encounterd in spring boot 3 with hibernate 6 is described here -> [https://stackoverflow.com/questions/76316577/org-hibernate-sql-ast-sqltreecreationexception-could-not-locate-tablegroup-mo](https://stackoverflow.com/questions/76316577/org-hibernate-sql-ast-sqltreecreationexception-could-not-locate-tablegroup-mo) but until now I get no resolution. I am stuck on this for days – Adrian May 25 '23 at 14:23

0 Answers0