|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.hibernate.proxy.AbstractLazyInitializer
public abstract class AbstractLazyInitializer
Convenience base class for lazy initialization handlers. Centralizes the basic plumbing of doing lazy initialization freeing subclasses to acts as essentially adapters to their intended entity mode and/or proxy generation strategy.
| Constructor Summary | |
|---|---|
protected |
AbstractLazyInitializer()
For serialization from the non-pojo initializers (HHH-3309) |
protected |
AbstractLazyInitializer(String entityName,
Serializable id,
SessionImplementor session)
Main constructor. |
| Method Summary | |
|---|---|
String |
getEntityName()
The entity-name of the entity our owning proxy represents. |
Serializable |
getIdentifier()
Retrieve the identifier value for the enity our owning proxy represents. |
Object |
getImplementation()
Return the underlying persistent object, initializing if necessary |
Object |
getImplementation(SessionImplementor s)
Return the underlying persistent object in the given Session, or null, do not initialize the proxy |
SessionImplementor |
getSession()
Get the session to which this proxy is associated, or null if it is not attached. |
protected Object |
getTarget()
Getter for property 'target'. |
void |
initialize()
Initialize the proxy, fetching the target entity if necessary. |
protected boolean |
isConnectedToSession()
Getter for property 'connectedToSession'. |
boolean |
isReadOnly()
Is the proxy read-only?. |
protected Boolean |
isReadOnlyBeforeAttachedToSession()
Get the read-only/modifiable setting that should be put in affect when it is attached to a session. |
boolean |
isReadOnlySettingAvailable()
Is the proxy's read-only/modifiable setting available? |
boolean |
isUninitialized()
Is the proxy uninitialzed? |
boolean |
isUnwrap()
|
void |
setIdentifier(Serializable id)
Set the identifier value for the enity our owning proxy represents. |
void |
setImplementation(Object target)
Initialize the proxy manually by injecting its target. |
void |
setReadOnly(boolean readOnly)
Set an associated modifiable proxy to read-only mode, or a read-only proxy to modifiable mode. |
void |
setSession(SessionImplementor s)
Associate the proxy with the given session. |
void |
setUnwrap(boolean unwrap)
|
void |
unsetSession()
Unset this initializer's reference to session. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.hibernate.proxy.LazyInitializer |
|---|
getPersistentClass |
| Constructor Detail |
|---|
protected AbstractLazyInitializer()
protected AbstractLazyInitializer(String entityName,
Serializable id,
SessionImplementor session)
entityName - The name of the entity being proxied.id - The identifier of the entity being proxied.session - The session owning the proxy.| Method Detail |
|---|
public final String getEntityName()
getEntityName in interface LazyInitializerpublic final Serializable getIdentifier()
getIdentifier in interface LazyInitializerpublic final void setIdentifier(Serializable id)
setIdentifier in interface LazyInitializerid - The identifier value.public final boolean isUninitialized()
isUninitialized in interface LazyInitializerpublic final SessionImplementor getSession()
getSession in interface LazyInitializer
public final void setSession(SessionImplementor s)
throws HibernateException
setSession in interface LazyInitializers - The session
HibernateException - Indicates that the proxy was still contained in the persistence context of the
"previous session".public final void unsetSession()
Session.evict(java.lang.Object) and
Session.clear() processing; most other use-cases should call LazyInitializer.setSession(org.hibernate.engine.SessionImplementor) instead.
unsetSession in interface LazyInitializer
public final void initialize()
throws HibernateException
initialize in interface LazyInitializerHibernateException - Indicates a problem initializing the proxy.protected final boolean isConnectedToSession()
public final Object getImplementation()
getImplementation in interface LazyInitializerpublic final void setImplementation(Object target)
setImplementation in interface LazyInitializertarget - The proxy target (the actual entity being proxied).
public final Object getImplementation(SessionImplementor s)
throws HibernateException
getImplementation in interface LazyInitializers - The session to check
HibernateException - Indicates problem locating the target.protected final Object getTarget()
getImplementation() except that this method will not force initialization.
public final boolean isReadOnlySettingAvailable()
isReadOnlySettingAvailable in interface LazyInitializerpublic final boolean isReadOnly()
isReadOnly in interface LazyInitializerLazyInitializer.isReadOnlySettingAvailable(),
Session.isReadOnly(Object entityOrProxy)public final void setReadOnly(boolean readOnly)
setReadOnly in interface LazyInitializerSession.setReadOnly(Object entityOrProxy, boolean readOnly)protected final Boolean isReadOnlyBeforeAttachedToSession()
IllegalStateException - if isReadOnlySettingAvailable() == truepublic boolean isUnwrap()
isUnwrap in interface LazyInitializerpublic void setUnwrap(boolean unwrap)
setUnwrap in interface LazyInitializer
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||