当前位置: 首页>>代码示例>>Java>>正文


Java LazyInitializer.isUnwrap方法代码示例

本文整理汇总了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 );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:38,代码来源:DefaultLoadEventListener.java

示例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 );
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:27,代码来源:DefaultLoadEventListener.java

示例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;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:FieldInterceptorImpl.java

示例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;
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:11,代码来源:FieldInterceptorImpl.java


注:本文中的org.hibernate.proxy.LazyInitializer.isUnwrap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。