Package org.hibernate.jpa.internal.util
Class PersistenceUtilHelper
- java.lang.Object
-
- org.hibernate.jpa.internal.util.PersistenceUtilHelper
-
public final class PersistenceUtilHelper extends Object
Central delegate for handling calls from:PersistenceUtil.isLoaded(Object)PersistenceUtil.isLoaded(Object, String)ProviderUtil.isLoaded(Object)ProviderUtil.isLoadedWithReference(Object, String)ProviderUtil.isLoadedWithoutReference(Object, String)li>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfacePersistenceUtilHelper.AttributeAccessstatic classPersistenceUtilHelper.AttributeExtractionExceptionstatic classPersistenceUtilHelper.ClassMetadataCachestatic classPersistenceUtilHelper.FieldAttributeAccessstatic classPersistenceUtilHelper.MetadataCacheCache hierarchy and member resolution in a weak hash mapstatic classPersistenceUtilHelper.MethodAttributeAccess
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static jakarta.persistence.spi.LoadStateisLoaded(Object reference)Determine if the given object reference represents loaded state.static jakarta.persistence.spi.LoadStateisLoadedWithoutReference(Object entity, String attributeName, PersistenceUtilHelper.MetadataCache cache)Is the given attribute (by name) loaded? This form must take care to not access the attribute (trigger initialization).static jakarta.persistence.spi.LoadStateisLoadedWithReference(Object entity, String attributeName, PersistenceUtilHelper.MetadataCache cache)Is the given attribute (by name) loaded? This form must take care to not access the attribute (trigger initialization).
-
-
-
Method Detail
-
isLoaded
public static jakarta.persistence.spi.LoadState isLoaded(Object reference)
Determine if the given object reference represents loaded state. The reference may be to an entity or a persistent collection. Return is defined as follows:-
If the reference is a
HibernateProxy, we returnLoadState.LOADEDifLazyInitializer.isUninitialized()returnsfalse; else we returnLoadState.NOT_LOADED -
If the reference is an enhanced (by Hibernate) entity, we return
LoadState.LOADEDifLazyAttributeLoadingInterceptor.hasAnyUninitializedAttributes()returnsfalse; otherwise we returnLoadState.NOT_LOADED -
If the reference is a
PersistentCollection, we returnLoadState.LOADEDifLazyInitializable.wasInitialized()returnstrue; else we returnLoadState.NOT_LOADED -
In all other cases we return
LoadState.UNKNOWN
- Parameters:
reference- The object reference to check.- Returns:
- The appropriate LoadState (see above)
-
If the reference is a
-
isLoadedWithoutReference
public static jakarta.persistence.spi.LoadState isLoadedWithoutReference(Object entity, String attributeName, PersistenceUtilHelper.MetadataCache cache)
Is the given attribute (by name) loaded? This form must take care to not access the attribute (trigger initialization).- Parameters:
entity- The entityattributeName- The name of the attribute to checkcache- The cache we maintain of attribute resolutions- Returns:
- The LoadState
-
isLoadedWithReference
public static jakarta.persistence.spi.LoadState isLoadedWithReference(Object entity, String attributeName, PersistenceUtilHelper.MetadataCache cache)
Is the given attribute (by name) loaded? This form must take care to not access the attribute (trigger initialization).- Parameters:
entity- The entityattributeName- The name of the attribute to checkcache- The cache we maintain of attribute resolutions- Returns:
- The LoadState
-
-