Hibernate 6.2 - from ClassCastException: BasicValue cannot be cast to ToOne to DataIntegrityViolationException
I was getting an error:
Caused by: java.lang.ClassCastException: 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')
I've read that there is a bug in Hibernate 6.2 regarding this issue, so I had to change the mapping of the entities in the application.
The entity was implemented as unidirectional, so the use of mappedBy was probably not correct. This...