Spring Boot 3 with Hibernate ORM 6.2.0

I upgraded my Spring Boot Application to version 3.0.2 and use Hibernate ORM 6.1.7.Final
Due to issues with “fetch” I wanted to try using ORM 6.2.0.Final to check if in this version our problems will go away but I even couldn’t start the app. I’m getting:

class org.hibernate.mapping.BasicValue cannot be cast to class org.hibernate.mapping.ToOne (org.hibernate.mapping.BasicValue and org.hibernate.mapping.ToOne are in unnamed module of loader ‘app’)

and it complains about Hibernate Configuration class.

do I need to add any additional dependencies to my pom to be able to use it ?
right now I have :

org.springframework.boot spring-boot-starter-parent 3.0.2 6.2.0.Final org.hibernate.orm hibernate-spatial ${hibernate.version} org.hibernate.orm hibernate-graalvm ${hibernate.version}

I checked: despite I didn’t specify

org.hibernate.orm hibernate-core ${hibernate.version}

the version for it was 6.2.0

1 Like

Hello, this error looks very similar to [HHH-16437] - Hibernate JIRA, but without the full stack trace and the mapping that causes the problem I can’t be sure.

Please check my comment and that issue and verify if you’re using mappedBy correctly in your associations.

Thank you for your response. I don’t use “id.fieldName” in mappedBy, just the normal field names.

The field name itself is not the problem, is the type of the field referenced with mappedBy which has to be an Entity type to correctly define a bi-directional association, not a basic type (like Integer or id).

As I said, without seeing your mappings it’s hard to say. I suggest you to read through the issue I linked, including the reference to the User Guide which explains this in more detail.


i made an example to reproduce: GitHub - mosesonline/jpa-error
Simply replace spring-boot versoin to 3.1.0 and the test breaks.

I don’t find anything in release notes or migration guides about this breaking change.

Hibernate Version 6.2.2 and 6.2.3.


Please post the error that you get. The problem sounds similar to [HHH-16593] - Hibernate JIRA though.