Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hibernate Envers 6.4.1: Illegal argument on static metamodel field injection

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

like image 214
zedoo Avatar asked Dec 05 '25 21:12

zedoo


1 Answers

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".

like image 103
IGNACIO ARAUJO Avatar answered Dec 08 '25 08:12

IGNACIO ARAUJO



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!