Skip to content

Commit 8dcb4c7

Browse files
committed
HHH-17612 Annotated envers supertype as @Entity instead of superclass
1 parent dd3be96 commit 8dcb4c7

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/reventity/removal/AbstractRevisionEntityRemovalTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ protected void addConfigOptions(Map options) {
3434
@Override
3535
protected Class<?>[] getAnnotatedClasses() {
3636
return new Class<?>[] {
37-
StrTestEntity.class, ListOwnedEntity.class, ListOwningEntity.class,
38-
getRevisionEntityClass()
37+
StrTestEntity.class, ListOwnedEntity.class, ListOwningEntity.class
3938
};
4039
}
4140

tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaType.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ else if ( hasAnnotation(annotationMetaEntity.getElement(), Constants.EMBEDDABLE)
7070
return "jakarta.persistence.metamodel.EmbeddableType";
7171
}
7272
else if ( hasAnnotation(annotationMetaEntity.getElement(), Constants.MAPPED_SUPERCLASS) ) {
73+
if ( annotationMetaEntity.getQualifiedName().startsWith( "org.hibernate.envers." ) ) {
74+
// This is a workaround for envers default revision entities which must be annotated
75+
// @MappedSuperclass to allow for custom revision entities extending them,
76+
// but if used by default are contributed (as hbm.xml mappings) as entities
77+
return "jakarta.persistence.metamodel.EntityType";
78+
}
7379
return "jakarta.persistence.metamodel.MappedSuperclassType";
7480
}
7581
else {

0 commit comments

Comments
 (0)