After upgrading to Spring Boot 3 and Hibernate 6, I have a use case not working about an enum :
It throws this exception :
Expecting code not to raise a throwable but caught
"org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction
...
at fr.elendar.hibernate_enum_mvce.repository.EntityClassNotWorkingRepositoryTest.lambda$test_ko$0(EntityClassNotWorkingRepositoryTest.java:22)
at org.assertj.core.api.ThrowableAssert.catchThrowable(ThrowableAssert.java:63)
at org.assertj.core.api.AssertionsForClassTypes.catchThrowable(AssertionsForClassTypes.java:892)
at org.assertj.core.api.AssertionsForClassTypes.assertThatCode(AssertionsForClassTypes.java:863)
at org.assertj.core.api.Assertions.assertThatCode(Assertions.java:1287)
at fr.elendar.hibernate_enum_mvce.repository.EntityClassNotWorkingRepositoryTest.test_ko(EntityClassNotWorkingRepositoryTest.java:18)
...
Caused by: jakarta.persistence.RollbackException: Error while committing the transaction
at org.hibernate.internal.ExceptionConverterImpl.convertCommitException(ExceptionConverterImpl.java:83)
at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:104)
at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:561)
... 104 more
Caused by: java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Character (java.lang.String and java.lang.Character are in module java.base of loader 'bootstrap')
at org.hibernate.type.descriptor.java.CharacterJavaType.unwrap(CharacterJavaType.java:20)
at org.hibernate.type.descriptor.jdbc.VarcharJdbcType$1.doBind(VarcharJdbcType.java:97)
at org.hibernate.type.descriptor.jdbc.BasicBinder.bind(BasicBinder.java:63)
...
... 105 more
I debugged it to this class and commit : https://github.com/hibernate/hibernate-orm/commit/2f8f04747b5a4555836d5b7e53da204c2fdaf022#diff-a237dd10cbb0420889ec2f389b747ecddccd6d31894337e375fe88dbacfe6093 and was told on Zulip Chat to create a bug here. I made a reproducer here, the test case in EntityClassNotWorkingRepositoryTest.java is failling and show the exception. I hope itโs enough, I tried to make a test case directly in hibernate-core and submit a PR, but I lacked enough knownleged to make it work ๐ |