public interface LazyInitializer
Modifier and Type | Method and Description |
---|---|
String |
getEntityName()
The entity-name of the entity our owning proxy represents.
|
Serializable |
getIdentifier()
Retrieve the identifier value for the entity our owning proxy represents.
|
Object |
getImplementation()
Return the underlying persistent object, initializing if necessary
|
Object |
getImplementation(SessionImplementor session)
Return the underlying persistent object in the given session, or null if not contained in this session's
persistence context.
|
Class |
getPersistentClass()
Get the actual class of the entity.
|
SessionImplementor |
getSession()
Get the session to which this proxy is associated, or null if it is not attached.
|
void |
initialize()
Initialize the proxy, fetching the target entity if necessary.
|
boolean |
isReadOnly()
Is the proxy read-only?.
|
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 entity 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 session)
Associate the proxy with the given session.
|
void |
setUnwrap(boolean unwrap) |
void |
unsetSession()
Unset this initializer's reference to session.
|
void initialize() throws HibernateException
HibernateException
- Indicates a problem initializing the proxy.Serializable getIdentifier()
void setIdentifier(Serializable id)
id
- The identifier value.String getEntityName()
Class getPersistentClass()
getEntityName()
should be used instead.boolean isUninitialized()
Object getImplementation()
Object getImplementation(SessionImplementor session) throws HibernateException
session
- The session to checkHibernateException
- Indicates problem locating the target.void setImplementation(Object target)
target
- The proxy target (the actual entity being proxied).boolean isReadOnlySettingAvailable()
boolean isReadOnly()
TransientObjectException
- if the proxy is detached (getSession() == null)SessionException
- if the proxy is associated with a sesssion that is closedisReadOnlySettingAvailable()
,
Session.isReadOnly(Object entityOrProxy)
void setReadOnly(boolean readOnly)
readOnly
- if true, the associated proxy is made read-only;
if false, the associated proxy is made modifiable.TransientObjectException
- if the proxy is not association with a sessionSessionException
- if the proxy is associated with a session that is closedSession.setReadOnly(Object entityOrProxy, boolean readOnly)
SessionImplementor getSession()
void setSession(SessionImplementor session) throws HibernateException
session
- The sessionHibernateException
- Indicates that the proxy was still contained in the persistence context of the
"previous session".void unsetSession()
Session.evict(java.lang.Object)
and
Session.clear()
processing; most other use-cases should call setSession(org.hibernate.engine.spi.SessionImplementor)
instead.void setUnwrap(boolean unwrap)
boolean isUnwrap()
Copyright © 2017 JBoss by Red Hat. All rights reserved.