21
21
import org .hibernate .HibernateException ;
22
22
import org .hibernate .MappingException ;
23
23
import org .hibernate .UnknownEntityTypeException ;
24
- import org .hibernate .boot .registry .classloading .spi .ClassLoaderService ;
25
- import org .hibernate .boot .registry .classloading .spi .ClassLoadingException ;
26
24
import org .hibernate .boot .spi .MetadataImplementor ;
27
25
import org .hibernate .cache .spi .CacheImplementor ;
28
26
import org .hibernate .cache .spi .access .CollectionDataAccess ;
@@ -104,8 +102,6 @@ public class MappingMetamodelImpl extends QueryParameterBindingTypeResolverImpl
104
102
//NOTE: we suppress deprecation warnings because at the moment we
105
103
//implement a deprecated API so have to override deprecated things
106
104
107
- private static final String [] EMPTY_IMPLEMENTORS = EMPTY_STRING_ARRAY ;
108
-
109
105
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
110
106
// JpaMetamodel
111
107
@@ -145,22 +141,8 @@ public class MappingMetamodelImpl extends QueryParameterBindingTypeResolverImpl
145
141
//
146
142
// To account for this, we track both paradigms here...
147
143
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.
162
145
163
- private final Map <String , String []> implementorsCache = new ConcurrentHashMap <>();
164
146
private final Map <TupleType <?>, MappingModelExpressible <?>> tupleTypeCache = new ConcurrentHashMap <>();
165
147
166
148
public MappingMetamodelImpl (TypeConfiguration typeConfiguration , ServiceRegistry serviceRegistry ) {
@@ -370,7 +352,7 @@ public void forEachEntityDescriptor(Consumer<EntityPersister> action) {
370
352
}
371
353
}
372
354
373
- @ Override
355
+ @ Override @ Deprecated ( forRemoval = true ) @ SuppressWarnings ( "removal" )
374
356
public Stream <EntityPersister > streamEntityDescriptors () {
375
357
return Arrays .stream ( entityPersisterMap .values () );
376
358
}
@@ -430,7 +412,7 @@ public EntityPersister getEntityDescriptor(Class<?> entityJavaType) {
430
412
return entityPersister ;
431
413
}
432
414
433
- @ Override
415
+ @ Override @ Deprecated ( forRemoval = true ) @ SuppressWarnings ( "removal" )
434
416
public EntityPersister locateEntityDescriptor (Class <?> byClass ) {
435
417
EntityPersister entityPersister = entityPersisterMap .get ( byClass .getName () );
436
418
if ( entityPersister == null ) {
@@ -542,43 +524,6 @@ public <E extends Enum<E>> E enumValue(EnumJavaType<E> enumType, String enumValu
542
524
return jpaMetamodel .enumValue ( enumType , enumValueName );
543
525
}
544
526
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
-
582
527
@ Override
583
528
public String getImportedName (String name ) {
584
529
final String qualifiedName = jpaMetamodel .qualifyImportableName ( name );
@@ -590,7 +535,7 @@ public void forEachCollectionDescriptor(Consumer<CollectionPersister> action) {
590
535
collectionPersisterMap .values ().forEach ( action );
591
536
}
592
537
593
- @ Override
538
+ @ Override @ Deprecated ( forRemoval = true ) @ SuppressWarnings ( "removal" )
594
539
public Stream <CollectionPersister > streamCollectionDescriptors () {
595
540
return collectionPersisterMap .values ().stream ();
596
541
}
@@ -847,9 +792,4 @@ public String[] getAllEntityNames() {
847
792
public String [] getAllCollectionRoles () {
848
793
return ArrayHelper .toStringArray ( collectionPersisterMap .keySet () );
849
794
}
850
-
851
- @ Override
852
- public void close () {
853
- // anything to do ?
854
- }
855
795
}
0 commit comments