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