Home » Hibernate-3.3.2.GA » org.hibernate » proxy » [javadoc | source]
org.hibernate.proxy
public interface: LazyInitializer [javadoc | source]

All Known Implementing Classes:
    BasicLazyInitializer, AbstractLazyInitializer, BasicLazyInitializer, JavassistLazyInitializer, Dom4jLazyInitializer, CGLIBLazyInitializer, CGLIBLazyInitializer, Dom4jLazyInitializer, MapLazyInitializer, MapLazyInitializer

Handles fetching of the underlying entity for a proxy
Method from org.hibernate.proxy.LazyInitializer Summary:
getEntityName,   getIdentifier,   getImplementation,   getImplementation,   getPersistentClass,   getSession,   initialize,   isUninitialized,   isUnwrap,   setIdentifier,   setImplementation,   setSession,   setUnwrap,   unsetSession
Method from org.hibernate.proxy.LazyInitializer Detail:
 public String getEntityName()
    The entity-name of the entity our owning proxy represents.
 public Serializable getIdentifier()
    Retrieve the identifier value for the enity our owning proxy represents.
 public Object getImplementation()
    Return the underlying persistent object, initializing if necessary
 abstract public Object getImplementation(SessionImplementor session) throws HibernateException
    Return the underlying persistent object in the given session, or null if not contained in this session's persistence context.
 public Class getPersistentClass()
    Get the actual class of the entity. Generally, #getEntityName() should be used instead.
 public SessionImplementor getSession()
    Get the session to which this proxy is associated, or null if it is not attached.
 public  void initialize() throws HibernateException
    Initialize the proxy, fetching the target entity if necessary.
 public boolean isUninitialized()
    Is the proxy uninitialzed?
 public boolean isUnwrap()
 public  void setIdentifier(Serializable id)
    Set the identifier value for the enity our owning proxy represents.
 public  void setImplementation(Object target)
    Initialize the proxy manually by injecting its target.
 public  void setSession(SessionImplementor session) throws HibernateException
    Associate the proxy with the given session.

    Care should be given to make certain that the proxy is added to the session's persistence context as well to maintain the symetry of the association. That must be done seperately as this method simply sets an internal reference. We do also check that if there is already an associated session that the proxy reference was removed from that previous session's persistence contet.

 public  void setUnwrap(boolean unwrap)
 public  void unsetSession()
    Unset this initializer's reference to session. It is assumed that the caller is also taking care or cleaning up the owning proxy's reference in the persistence context.

    Generally speaking this is intended to be called only during org.hibernate.Session#evict and org.hibernate.Session#clear processing; most other use-cases should call #setSession instead.