Class LazyAttributeLoadingInterceptor
java.lang.Object
org.hibernate.bytecode.enhance.spi.interceptor.AbstractInterceptor
org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor
- All Implemented Interfaces:
BytecodeLazyAttributeInterceptor,SessionAssociableInterceptor,LazyPropertyInitializer.InterceptorImplementor,PersistentAttributeInterceptor
public class LazyAttributeLoadingInterceptor
extends AbstractInterceptor
implements BytecodeLazyAttributeInterceptor
Interceptor that loads attributes lazily
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis is an helper object to group all state which relates to a particular entity type, and which is needed for this interceptor. -
Constructor Summary
ConstructorsConstructorDescriptionLazyAttributeLoadingInterceptor(LazyAttributeLoadingInterceptor.EntityRelatedState entityMeta, Object identifier, SharedSessionContractImplementor session) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLazyFieldByGraph(String fieldName) voidattributeInitialized(String name) Callback from the enhanced class that an attribute has been read or writtenvoidfetchAttribute(Object target, String attributeName) Fetches the lazy attribute.The name of the entity this interceptor is meant to interceptThe id of the entity instance this interceptor is associated withThe names of all lazy attributes which have been initializedprotected ObjecthandleRead(Object target, String attributeName, Object value) Handle the case of reading an attribute.protected ObjecthandleWrite(Object target, String attributeName, Object oldValue, Object newValue) Handle the case of writing an attribute.booleanbooleanisAttributeLoaded(String fieldName) Callback from the enhanced class that an attribute has been loadedprotected ObjectloadAttribute(Object target, String attributeName) toString()Methods inherited from class org.hibernate.bytecode.enhance.spi.interceptor.AbstractInterceptor
allowLoadOutsideTransaction, getLinkedSession, getSessionFactoryUuid, readBoolean, readByte, readChar, readDouble, readFloat, readInt, readLong, readObject, readShort, setSession, unsetSession, writeBoolean, writeByte, writeChar, writeDouble, writeFloat, writeInt, writeLong, writeObject, writeShortMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.hibernate.engine.spi.PersistentAttributeInterceptor
readBoolean, readByte, readChar, readDouble, readFloat, readInt, readLong, readObject, readShort, writeBoolean, writeByte, writeChar, writeDouble, writeFloat, writeInt, writeLong, writeObject, writeShortMethods inherited from interface org.hibernate.bytecode.enhance.spi.interceptor.SessionAssociableInterceptor
allowLoadOutsideTransaction, getLinkedSession, getSessionFactoryUuid, setSession, unsetSession
-
Constructor Details
-
Method Details
-
getEntityName
Description copied from interface:BytecodeLazyAttributeInterceptorThe name of the entity this interceptor is meant to intercept- Specified by:
getEntityNamein interfaceBytecodeLazyAttributeInterceptor
-
getIdentifier
Description copied from interface:BytecodeLazyAttributeInterceptorThe id of the entity instance this interceptor is associated with- Specified by:
getIdentifierin interfaceBytecodeLazyAttributeInterceptor
-
handleRead
Description copied from class:AbstractInterceptorHandle the case of reading an attribute. The result is what is returned to the caller- Specified by:
handleReadin classAbstractInterceptor
-
handleWrite
Description copied from class:AbstractInterceptorHandle the case of writing an attribute. The result is what is set as the entity state- Specified by:
handleWritein classAbstractInterceptor
-
fetchAttribute
Fetches the lazy attribute. The attribute does not get associated with the entity. (To be used by hibernate methods) -
loadAttribute
-
isAttributeLoaded
Description copied from interface:PersistentAttributeInterceptorCallback from the enhanced class that an attribute has been loaded- Specified by:
isAttributeLoadedin interfaceBytecodeLazyAttributeInterceptor- Specified by:
isAttributeLoadedin interfacePersistentAttributeInterceptor- Parameters:
fieldName-- Returns:
- true id the attribute is loaded false otherwise
-
hasAnyUninitializedAttributes
public boolean hasAnyUninitializedAttributes()- Specified by:
hasAnyUninitializedAttributesin interfaceBytecodeLazyAttributeInterceptor
-
toString
-
attributeInitialized
Description copied from interface:BytecodeLazyAttributeInterceptorCallback from the enhanced class that an attribute has been read or written- Specified by:
attributeInitializedin interfaceBytecodeLazyAttributeInterceptor- Specified by:
attributeInitializedin interfaceLazyPropertyInitializer.InterceptorImplementor- Specified by:
attributeInitializedin interfacePersistentAttributeInterceptor
-
getInitializedLazyAttributeNames
Description copied from interface:BytecodeLazyAttributeInterceptorThe names of all lazy attributes which have been initialized- Specified by:
getInitializedLazyAttributeNamesin interfaceBytecodeLazyAttributeInterceptor- Specified by:
getInitializedLazyAttributeNamesin interfaceLazyPropertyInitializer.InterceptorImplementor- Specified by:
getInitializedLazyAttributeNamesin interfacePersistentAttributeInterceptor
-
addLazyFieldByGraph
-
clearInitializedLazyFields
public void clearInitializedLazyFields()
-