23
23
import org .hibernate .engine .spi .SessionImplementor ;
24
24
import org .hibernate .mapping .Property ;
25
25
import org .hibernate .metamodel .MappingMetamodel ;
26
+ import org .hibernate .metamodel .mapping .EntityMappingType ;
26
27
import org .hibernate .persister .entity .EntityPersister ;
27
28
import org .hibernate .search .mapper .orm .logging .impl .Log ;
28
29
import org .hibernate .search .util .common .annotation .impl .SuppressForbiddenApis ;
@@ -83,8 +84,7 @@ public static EntityPersister toRootEntityType(SessionFactoryImplementor session
83
84
return metamodel .getEntityDescriptor ( rootEntityName );
84
85
}
85
86
86
- public static EntityPersister toMostSpecificCommonEntitySuperType (MappingMetamodel metamodel ,
87
- EntityPersister type1 , EntityPersister type2 ) {
87
+ public static EntityPersister toMostSpecificCommonEntitySuperType (EntityPersister type1 , EntityPersister type2 ) {
88
88
/*
89
89
* We need to rely on Hibernate ORM's SPIs: this is complex stuff.
90
90
* For example there may be class hierarchies such as A > B > C
@@ -94,10 +94,9 @@ public static EntityPersister toMostSpecificCommonEntitySuperType(MappingMetamod
94
94
*/
95
95
EntityPersister superTypeCandidate = type1 ;
96
96
while ( superTypeCandidate != null && !isSuperTypeOf ( superTypeCandidate , type2 ) ) {
97
- String superSuperTypeEntityName = superTypeCandidate .getEntityMetamodel ().getSuperclass ();
98
- superTypeCandidate = superSuperTypeEntityName == null
99
- ? null
100
- : metamodel .getEntityDescriptor ( superSuperTypeEntityName ).getEntityPersister ();
97
+ EntityMappingType superSuperType = superTypeCandidate .getSuperMappingType ();
98
+ superTypeCandidate = superSuperType == null
99
+ ? null : superSuperType .getEntityPersister ();
101
100
}
102
101
if ( superTypeCandidate == null ) {
103
102
throw new AssertionFailure (
@@ -121,7 +120,7 @@ public static boolean targetsAllConcreteSubTypes(SessionFactoryImplementor sessi
121
120
MappingMetamodel metamodel = sessionFactory .getMappingMetamodel ();
122
121
int concreteSubTypesCount = 0 ;
123
122
for ( String subClassEntityName : subClassEntityNames ) {
124
- if ( !metamodel .getEntityDescriptor ( subClassEntityName ).getEntityMetamodel (). isAbstract () ) {
123
+ if ( !metamodel .getEntityDescriptor ( subClassEntityName ).isAbstract () ) {
125
124
++concreteSubTypesCount ;
126
125
}
127
126
}
0 commit comments