Class LazyAttributeLoadingInterceptor
- java.lang.Object
-
- org.hibernate.bytecode.enhance.spi.interceptor.AbstractInterceptor
-
- org.hibernate.bytecode.enhance.spi.interceptor.AbstractLazyLoadInterceptor
-
- org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor
-
- All Implemented Interfaces:
BytecodeLazyAttributeInterceptor
,SessionAssociableInterceptor
,LazyPropertyInitializer.InterceptorImplementor
,PersistentAttributeInterceptor
public class LazyAttributeLoadingInterceptor extends AbstractLazyLoadInterceptor
Interceptor that loads attributes lazily
-
-
Constructor Summary
Constructors Constructor Description LazyAttributeLoadingInterceptor(String entityName, Object identifier, Set<String> lazyFields, SharedSessionContractImplementor session)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLazyFieldByGraph(String fieldName)
void
attributeInitialized(String name)
Callback from the enhanced class that an attribute has been read or writtenObject
fetchAttribute(Object target, String attributeName)
Fetches the lazy attribute.Object
getIdentifier()
The id of the entity instance this interceptor is associated withSet<String>
getInitializedLazyAttributeNames()
The names of all lazy attributes which have been initializedprotected Object
handleRead(Object target, String attributeName, Object value)
Handle the case of reading an attribute.protected Object
handleWrite(Object target, String attributeName, Object oldValue, Object newValue)
Handle the case of writing an attribute.boolean
hasAnyUninitializedAttributes()
boolean
isAttributeLoaded(String fieldName)
Callback from the enhanced class that an attribute has been loadedprotected Object
loadAttribute(Object target, String attributeName)
String
toString()
-
Methods inherited from class org.hibernate.bytecode.enhance.spi.interceptor.AbstractInterceptor
allowLoadOutsideTransaction, getEntityName, getLinkedSession, getSessionFactoryUuid, readBoolean, readByte, readChar, readDouble, readFloat, readInt, readLong, readObject, readShort, setSession, unsetSession, writeBoolean, writeByte, writeChar, writeDouble, writeFloat, writeInt, writeLong, writeObject, writeShort
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hibernate.bytecode.enhance.spi.interceptor.BytecodeLazyAttributeInterceptor
getEntityName
-
Methods 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, writeShort
-
Methods inherited from interface org.hibernate.bytecode.enhance.spi.interceptor.SessionAssociableInterceptor
allowLoadOutsideTransaction, getLinkedSession, getSessionFactoryUuid, setSession, unsetSession
-
-
-
-
Constructor Detail
-
LazyAttributeLoadingInterceptor
public LazyAttributeLoadingInterceptor(String entityName, Object identifier, Set<String> lazyFields, SharedSessionContractImplementor session)
-
-
Method Detail
-
getIdentifier
public Object getIdentifier()
Description copied from interface:BytecodeLazyAttributeInterceptor
The id of the entity instance this interceptor is associated with
-
handleRead
protected Object handleRead(Object target, String attributeName, Object value)
Description copied from class:AbstractInterceptor
Handle the case of reading an attribute. The result is what is returned to the caller- Specified by:
handleRead
in classAbstractInterceptor
-
handleWrite
protected Object handleWrite(Object target, String attributeName, Object oldValue, Object newValue)
Description copied from class:AbstractInterceptor
Handle the case of writing an attribute. The result is what is set as the entity state- Specified by:
handleWrite
in classAbstractInterceptor
-
fetchAttribute
public Object fetchAttribute(Object target, String attributeName)
Fetches the lazy attribute. The attribute does not get associated with the entity. (To be used by hibernate methods)
-
isAttributeLoaded
public boolean isAttributeLoaded(String fieldName)
Description copied from interface:PersistentAttributeInterceptor
Callback from the enhanced class that an attribute has been loaded- Returns:
- true id the attribute is loaded false otherwise
-
hasAnyUninitializedAttributes
public boolean hasAnyUninitializedAttributes()
-
attributeInitialized
public void attributeInitialized(String name)
Description copied from interface:BytecodeLazyAttributeInterceptor
Callback from the enhanced class that an attribute has been read or written
-
getInitializedLazyAttributeNames
public Set<String> getInitializedLazyAttributeNames()
Description copied from interface:BytecodeLazyAttributeInterceptor
The names of all lazy attributes which have been initialized
-
addLazyFieldByGraph
public void addLazyFieldByGraph(String fieldName)
-
-