7
7
package org .hibernate .internal ;
8
8
9
9
import java .util .ArrayList ;
10
- import java .util .Arrays ;
11
10
import java .util .List ;
12
11
import java .util .Set ;
13
12
import java .util .function .BiConsumer ;
32
31
import org .hibernate .engine .spi .EntityKey ;
33
32
import org .hibernate .engine .spi .LoadQueryInfluencers ;
34
33
import org .hibernate .engine .spi .PersistenceContext ;
35
- import org .hibernate .engine .spi .PersistentAttributeInterceptable ;
36
- import org .hibernate .engine .spi .PersistentAttributeInterceptor ;
37
34
import org .hibernate .engine .transaction .internal .jta .JtaStatusHelper ;
38
35
import org .hibernate .engine .transaction .jta .platform .spi .JtaPlatform ;
39
36
import org .hibernate .event .spi .PostDeleteEvent ;
71
68
import jakarta .persistence .EntityGraph ;
72
69
import jakarta .transaction .SystemException ;
73
70
74
- import static java .util .Arrays .asList ;
75
71
import static org .hibernate .engine .internal .ManagedTypeHelper .asPersistentAttributeInterceptable ;
76
72
import static org .hibernate .engine .internal .ManagedTypeHelper .isPersistentAttributeInterceptable ;
77
73
import static org .hibernate .engine .internal .Versioning .incrementVersion ;
@@ -760,11 +756,8 @@ public void fetch(Object association) {
760
756
}
761
757
}
762
758
else if ( isPersistentAttributeInterceptable ( association ) ) {
763
- final PersistentAttributeInterceptable interceptable = asPersistentAttributeInterceptable ( association );
764
- final PersistentAttributeInterceptor interceptor = interceptable .$$_hibernate_getInterceptor ();
765
- if ( interceptor instanceof EnhancementAsProxyLazinessInterceptor ) {
766
- final EnhancementAsProxyLazinessInterceptor proxyInterceptor =
767
- (EnhancementAsProxyLazinessInterceptor ) interceptor ;
759
+ if ( asPersistentAttributeInterceptable ( association ).$$_hibernate_getInterceptor ()
760
+ instanceof EnhancementAsProxyLazinessInterceptor proxyInterceptor ) {
768
761
proxyInterceptor .setSession ( this );
769
762
try {
770
763
proxyInterceptor .forceInitialize ( association , null );
@@ -778,8 +771,7 @@ else if ( isPersistentAttributeInterceptable( association ) ) {
778
771
}
779
772
}
780
773
}
781
- else if ( association instanceof PersistentCollection ) {
782
- final PersistentCollection <?> persistentCollection = (PersistentCollection <?>) association ;
774
+ else if ( association instanceof PersistentCollection <?> persistentCollection ) {
783
775
if ( !persistentCollection .wasInitialized () ) {
784
776
final CollectionPersister collectionDescriptor = getFactory ().getMappingMetamodel ()
785
777
.getCollectionDescriptor ( persistentCollection .getRole () );
0 commit comments