2121import org .hibernate .HibernateException ;
2222import org .hibernate .MappingException ;
2323import org .hibernate .UnknownEntityTypeException ;
24- import org .hibernate .boot .registry .classloading .spi .ClassLoaderService ;
25- import org .hibernate .boot .registry .classloading .spi .ClassLoadingException ;
2624import org .hibernate .boot .spi .MetadataImplementor ;
2725import org .hibernate .cache .spi .CacheImplementor ;
2826import org .hibernate .cache .spi .access .CollectionDataAccess ;
@@ -104,8 +102,6 @@ public class MappingMetamodelImpl extends QueryParameterBindingTypeResolverImpl
104102 //NOTE: we suppress deprecation warnings because at the moment we
105103 //implement a deprecated API so have to override deprecated things
106104
107- private static final String [] EMPTY_IMPLEMENTORS = EMPTY_STRING_ARRAY ;
108-
109105 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
110106 // JpaMetamodel
111107
@@ -145,22 +141,8 @@ public class MappingMetamodelImpl extends QueryParameterBindingTypeResolverImpl
145141 //
146142 // To account for this, we track both paradigms here...
147143
148- /*
149- * There can be multiple instances of an Embeddable type, each one being relative to its parent entity.
150- */
151-
152- /**
153- * That's not strictly correct in the JPA standard since for a given Java type we could have
154- * multiple instances of an embeddable type. Some embeddable might override attributes, but we
155- * can only return a single EmbeddableTypeImpl for a given Java object class.
156- * <p>
157- * A better approach would be if the parent class and attribute name would be included as well
158- * when trying to locate the embeddable type.
159- */
160- // private final Map<Class<?>, EmbeddableDomainType<?>> jpaEmbeddableTypeMap = new ConcurrentHashMap<>();
161- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
144+ // There can be multiple instances of an Embeddable type, each one being relative to its parent entity.
162145
163- private final Map <String , String []> implementorsCache = new ConcurrentHashMap <>();
164146 private final Map <TupleType <?>, MappingModelExpressible <?>> tupleTypeCache = new ConcurrentHashMap <>();
165147
166148 public MappingMetamodelImpl (TypeConfiguration typeConfiguration , ServiceRegistry serviceRegistry ) {
@@ -370,7 +352,7 @@ public void forEachEntityDescriptor(Consumer<EntityPersister> action) {
370352 }
371353 }
372354
373- @ Override
355+ @ Override @ Deprecated ( forRemoval = true ) @ SuppressWarnings ( "removal" )
374356 public Stream <EntityPersister > streamEntityDescriptors () {
375357 return Arrays .stream ( entityPersisterMap .values () );
376358 }
@@ -430,7 +412,7 @@ public EntityPersister getEntityDescriptor(Class<?> entityJavaType) {
430412 return entityPersister ;
431413 }
432414
433- @ Override
415+ @ Override @ Deprecated ( forRemoval = true ) @ SuppressWarnings ( "removal" )
434416 public EntityPersister locateEntityDescriptor (Class <?> byClass ) {
435417 EntityPersister entityPersister = entityPersisterMap .get ( byClass .getName () );
436418 if ( entityPersister == null ) {
@@ -542,43 +524,6 @@ public <E extends Enum<E>> E enumValue(EnumJavaType<E> enumType, String enumValu
542524 return jpaMetamodel .enumValue ( enumType , enumValueName );
543525 }
544526
545- public String [] getImplementors (String className ) throws MappingException {
546- // computeIfAbsent() can be a contention point and we expect all the values to be in the map at some point so
547- // let's do an optimistic check first
548- String [] implementors = implementorsCache .get ( className );
549- if ( implementors != null ) {
550- return Arrays .copyOf ( implementors , implementors .length );
551- }
552-
553- try {
554- final Class <?> clazz =
555- jpaMetamodel .getServiceRegistry ().requireService ( ClassLoaderService .class )
556- .classForName ( className );
557- implementors = doGetImplementors ( clazz );
558- if ( implementors .length > 0 ) {
559- implementorsCache .putIfAbsent ( className , implementors );
560- return Arrays .copyOf ( implementors , implementors .length );
561- }
562- else {
563- return EMPTY_IMPLEMENTORS ;
564- }
565- }
566- catch (ClassLoadingException e ) {
567- return new String [] { className }; // we don't cache anything for dynamic classes
568- }
569- }
570-
571-
572-
573- @ Override
574- public EntityPersister locateEntityPersister (String byName ) {
575- final EntityPersister entityPersister = entityPersisterMap .get ( byName );
576- if ( entityPersister == null ) {
577- throw new UnknownEntityTypeException ( "Unable to locate persister: " + byName );
578- }
579- return entityPersister ;
580- }
581-
582527 @ Override
583528 public String getImportedName (String name ) {
584529 final String qualifiedName = jpaMetamodel .qualifyImportableName ( name );
@@ -590,7 +535,7 @@ public void forEachCollectionDescriptor(Consumer<CollectionPersister> action) {
590535 collectionPersisterMap .values ().forEach ( action );
591536 }
592537
593- @ Override
538+ @ Override @ Deprecated ( forRemoval = true ) @ SuppressWarnings ( "removal" )
594539 public Stream <CollectionPersister > streamCollectionDescriptors () {
595540 return collectionPersisterMap .values ().stream ();
596541 }
@@ -847,9 +792,4 @@ public String[] getAllEntityNames() {
847792 public String [] getAllCollectionRoles () {
848793 return ArrayHelper .toStringArray ( collectionPersisterMap .keySet () );
849794 }
850-
851- @ Override
852- public void close () {
853- // anything to do ?
854- }
855795}
0 commit comments