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


Java CollectionPersister.isLazy方法代码示例

本文整理汇总了Java中org.hibernate.persister.collection.CollectionPersister.isLazy方法的典型用法代码示例。如果您正苦于以下问题:Java CollectionPersister.isLazy方法的具体用法?Java CollectionPersister.isLazy怎么用?Java CollectionPersister.isLazy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.hibernate.persister.collection.CollectionPersister的用法示例。


在下文中一共展示了CollectionPersister.isLazy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isSubsequentSelectDelayed

import org.hibernate.persister.collection.CollectionPersister; //导入方法依赖的package包/类
private static boolean isSubsequentSelectDelayed(AssociationType type, SessionFactoryImplementor sessionFactory) {
	if ( type.isAnyType() ) {
		// we'd need more context here.  this is only kept as part of the property state on the owning entity
		return false;
	}
	else if ( type.isEntityType() ) {
		return ( (EntityPersister) type.getAssociatedJoinable( sessionFactory ) ).hasProxy();
	}
	else {
		final CollectionPersister cp = ( (CollectionPersister) type.getAssociatedJoinable( sessionFactory ) );
		return cp.isLazy() || cp.isExtraLazy();
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:FetchStrategyHelper.java

示例2: getCollection

import org.hibernate.persister.collection.CollectionPersister; //导入方法依赖的package包/类
/**
 * instantiate a collection wrapper (called when loading an object)
 *
 * @param key The collection owner key
 * @param session The session from which the request is originating.
 * @param owner The collection owner
 * @return The collection
 */
public Object getCollection(Serializable key, SessionImplementor session, Object owner) {

	CollectionPersister persister = getPersister( session );
	final PersistenceContext persistenceContext = session.getPersistenceContext();
	final EntityMode entityMode = persister.getOwnerEntityPersister().getEntityMode();

	// check if collection is currently being loaded
	PersistentCollection collection = persistenceContext.getLoadContexts().locateLoadingCollection( persister, key );
	
	if ( collection == null ) {
		
		// check if it is already completely loaded, but unowned
		collection = persistenceContext.useUnownedCollection( new CollectionKey(persister, key, entityMode) );
		
		if ( collection == null ) {
			// create a new collection wrapper, to be initialized later
			collection = instantiate( session, persister, key );
			
			collection.setOwner(owner);

			persistenceContext.addUninitializedCollection( persister, collection, key );

			// some collections are not lazy:
			if ( initializeImmediately() ) {
				session.initializeCollection( collection, false );
			}
			else if ( !persister.isLazy() ) {
				persistenceContext.addNonLazyCollection( collection );
			}

			if ( hasHolder() ) {
				session.getPersistenceContext().addCollectionHolder( collection );
			}
			
		}
		
		if ( LOG.isTraceEnabled() ) {
			LOG.tracef( "Created collection wrapper: %s",
					MessageHelper.collectionInfoString( persister, collection,
							key, session ) );
		}
		
	}
	
	collection.setOwner(owner);

	return collection.getValue();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:57,代码来源:CollectionType.java


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