org.hibernate.proxy

Class AbstractLazyInitializer

Implemented Interfaces:
LazyInitializer
Known Direct Subclasses:
BasicLazyInitializer, Dom4jLazyInitializer, MapLazyInitializer

public abstract class AbstractLazyInitializer
extends java.lang.Object
implements LazyInitializer

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.
Author:
Gavin King

Constructor Summary

AbstractLazyInitializer(String entityName, Serializable id, SessionImplementor session)

Method Summary

String
getEntityName()
Serializable
getIdentifier()
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()
protected Object
getTarget()
void
initialize()
protected boolean
isConnectedToSession()
boolean
isUninitialized()
boolean
isUnwrap()
void
setIdentifier(Serializable id)
void
setImplementation(Object target)
void
setSession(SessionImplementor s)
void
setUnwrap(boolean unwrap)

Constructor Details

AbstractLazyInitializer

protected AbstractLazyInitializer(String entityName,
                                  Serializable id,
                                  SessionImplementor session)

Method Details

getEntityName

public final String getEntityName()
Specified by:
getEntityName in interface LazyInitializer

getIdentifier

public final Serializable getIdentifier()
Specified by:
getIdentifier in interface LazyInitializer

getImplementation

public final Object getImplementation()
Return the underlying persistent object, initializing if necessary
Specified by:
getImplementation in interface LazyInitializer

getImplementation

public final Object getImplementation(SessionImplementor s)
            throws HibernateException
Return the underlying persistent object in the given Session, or null, do not initialize the proxy
Specified by:
getImplementation in interface LazyInitializer

getSession

public final SessionImplementor getSession()
Specified by:
getSession in interface LazyInitializer

getTarget

protected final Object getTarget()

initialize

public final void initialize()
            throws HibernateException
Specified by:
initialize in interface LazyInitializer

isConnectedToSession

protected final boolean isConnectedToSession()

isUninitialized

public final boolean isUninitialized()
Specified by:
isUninitialized in interface LazyInitializer

isUnwrap

public boolean isUnwrap()
Specified by:
isUnwrap in interface LazyInitializer

setIdentifier

public final void setIdentifier(Serializable id)
Specified by:
setIdentifier in interface LazyInitializer

setImplementation

public final void setImplementation(Object target)
Specified by:
setImplementation in interface LazyInitializer

setSession

public final void setSession(SessionImplementor s)
            throws HibernateException
Specified by:
setSession in interface LazyInitializer

setUnwrap

public void setUnwrap(boolean unwrap)
Specified by:
setUnwrap in interface LazyInitializer