本文整理汇总了Java中org.hibernate.proxy.LazyInitializer.isUnwrap方法的典型用法代码示例。如果您正苦于以下问题:Java LazyInitializer.isUnwrap方法的具体用法?Java LazyInitializer.isUnwrap怎么用?Java LazyInitializer.isUnwrap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.proxy.LazyInitializer
的用法示例。
在下文中一共展示了LazyInitializer.isUnwrap方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: returnNarrowedProxy
import org.hibernate.proxy.LazyInitializer; //导入方法依赖的package包/类
/**
* Given a proxy, initialize it and/or narrow it provided either
* is necessary.
*
* @param event The initiating load request event
* @param persister The persister corresponding to the entity to be loaded
* @param keyToLoad The key of the entity to be loaded
* @param options The defined load options
* @param persistenceContext The originating session
* @param proxy The proxy to narrow
*
* @return The created/existing proxy
*/
private Object returnNarrowedProxy(
final LoadEvent event,
final EntityPersister persister,
final EntityKey keyToLoad,
final LoadEventListener.LoadType options,
final PersistenceContext persistenceContext,
final Object proxy) {
LOG.trace( "Entity proxy found in session cache" );
LazyInitializer li = ( (HibernateProxy) proxy ).getHibernateLazyInitializer();
if ( li.isUnwrap() ) {
return li.getImplementation();
}
Object impl = null;
if ( !options.isAllowProxyCreation() ) {
impl = load( event, persister, keyToLoad, options );
if ( impl == null ) {
event.getSession()
.getFactory()
.getEntityNotFoundDelegate()
.handleEntityNotFound( persister.getEntityName(), keyToLoad.getIdentifier() );
}
}
return persistenceContext.narrowProxy( proxy, persister, keyToLoad, impl );
}
示例2: returnNarrowedProxy
import org.hibernate.proxy.LazyInitializer; //导入方法依赖的package包/类
/**
* Given that there is a pre-existing proxy.
* Initialize it if necessary; narrow if necessary.
*/
private Object returnNarrowedProxy(
final LoadEvent event,
final EntityPersister persister,
final EntityKey keyToLoad,
final LoadEventListener.LoadType options,
final PersistenceContext persistenceContext,
final Object proxy
) {
log.trace("entity proxy found in session cache");
LazyInitializer li = ( (HibernateProxy) proxy ).getHibernateLazyInitializer();
if ( li.isUnwrap() ) {
return li.getImplementation();
}
Object impl = null;
if ( !options.isAllowProxyCreation() ) {
impl = load( event, persister, keyToLoad, options );
if ( impl == null ) {
event.getSession().getFactory().getEntityNotFoundDelegate().handleEntityNotFound( persister.getEntityName(), keyToLoad.getIdentifier());
}
}
return persistenceContext.narrowProxy( proxy, persister, keyToLoad, impl );
}
示例3: readObject
import org.hibernate.proxy.LazyInitializer; //导入方法依赖的package包/类
@Override
public Object readObject(Object target, String name, Object oldValue) {
Object value = intercept( target, name, oldValue );
if ( value instanceof HibernateProxy ) {
final LazyInitializer li = ( (HibernateProxy) value ).getHibernateLazyInitializer();
if ( li.isUnwrap() ) {
value = li.getImplementation();
}
}
return value;
}
示例4: readObject
import org.hibernate.proxy.LazyInitializer; //导入方法依赖的package包/类
public Object readObject(Object target, String name, Object oldValue) {
Object value = intercept( target, name, oldValue );
if (value instanceof HibernateProxy) {
LazyInitializer li = ( (HibernateProxy) value ).getHibernateLazyInitializer();
if ( li.isUnwrap() ) {
value = li.getImplementation();
}
}
return value;
}