I migrate to Hibernate 6.4.1 (via spring boot 3.2.1) and my app logs an error that wasnt' there before:
2024-01-03T15:49:10.361+01:00 ERROR 81857 --- [ main]
o.h.metamodel.internal.MetadataContext :
HHH015007: Illegal argument on static metamodel field injection :
org.hibernate.envers.DefaultRevisionEntity_#class_; expected type :
org.hibernate.metamodel.model.domain.internal.EntityTypeImpl; encountered type :
jakarta.persistence.metamodel.MappedSuperclassType
I can reproduce this with a minimal example by basically copying the code from spring data envers documentation: https://docs.spring.io/spring-data/jpa/reference/envers/configuration.html
I can also reproduce this by running the spring-data-envers example: https://github.com/spring-projects/spring-data-examples/blob/main/jpa/envers/pom.xml
I can also reproduce this by running https://github.com/hibernate/hibernate-orm/blob/main/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/DefaultAuditTest.java
Created issue https://hibernate.atlassian.net/jira/software/c/projects/HHH/boards/31?selectedIssue=HHH-17612
In my case, using the @Audited annotation of hibernate envers caused the error. I resolved the error by removing the dependency implementation "org.hibernate:hibernate-envers" and adding implementation "org.hibernate:hibernate-envers-jakarta:5.6.15.Final".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With