當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityPersister.hasProxy方法代碼示例

本文整理匯總了Java中org.hibernate.persister.entity.EntityPersister.hasProxy方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityPersister.hasProxy方法的具體用法?Java EntityPersister.hasProxy怎麽用?Java EntityPersister.hasProxy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.hibernate.persister.entity.EntityPersister的用法示例。


在下文中一共展示了EntityPersister.hasProxy方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isJoinedFetchEnabledInMapping

import org.hibernate.persister.entity.EntityPersister; //導入方法依賴的package包/類
/**
 * Does the mapping, and Hibernate default semantics, specify that
 * this association should be fetched by outer joining
 */
protected boolean isJoinedFetchEnabledInMapping(FetchMode config, AssociationType type) 
throws MappingException {
	if ( !type.isEntityType() && !type.isCollectionType() ) {
		return false;
	}
	else {
		if (config==FetchMode.JOIN) return true;
		if (config==FetchMode.SELECT) return false;
		if ( type.isEntityType() ) {
			//TODO: look at the owning property and check that it 
			//      isn't lazy (by instrumentation)
			EntityType entityType =(EntityType) type;
			EntityPersister persister = getFactory().getEntityPersister( entityType.getAssociatedEntityName() );
			return !persister.hasProxy();
		}
		else {
			return false;
		}
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:25,代碼來源:JoinWalker.java

示例2: internalLoad

import org.hibernate.persister.entity.EntityPersister; //導入方法依賴的package包/類
@Override
public Object internalLoad(
		String entityName,
        Serializable id,
        boolean eager,
        boolean nullable) throws HibernateException {
	errorIfClosed();
	EntityPersister persister = getFactory().getEntityPersister( entityName );
	// first, try to load it from the temp PC associated to this SS
	Object loaded = temporaryPersistenceContext.getEntity( generateEntityKey( id, persister ) );
	if ( loaded != null ) {
		// we found it in the temp PC.  Should indicate we are in the midst of processing a result set
		// containing eager fetches via join fetch
		return loaded;
	}
	if ( !eager && persister.hasProxy() ) {
		// if the metadata allowed proxy creation and caller did not request forceful eager loading,
		// generate a proxy
		return persister.createProxy( id, this );
	}
	// otherwise immediately materialize it
	return get( entityName, id );
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:24,代碼來源:StatelessSessionImpl.java

示例3: proxyFor

import org.hibernate.persister.entity.EntityPersister; //導入方法依賴的package包/類
@Override
public Object proxyFor(EntityPersister persister, EntityKey key, Object impl) throws HibernateException {
	if ( !persister.hasProxy() ) {
		return impl;
	}
	final Object proxy = proxiesByKey.get( key );
	return ( proxy != null ) ? narrowProxy( proxy, persister, key, impl ) : impl;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:9,代碼來源:StatefulPersistenceContext.java

示例4: proxyOrLoad

import org.hibernate.persister.entity.EntityPersister; //導入方法依賴的package包/類
/**
 * Based on configured options, will either return a pre-existing proxy,
 * generate a new proxy, or perform an actual load.
 *
 * @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
 *
 * @return The result of the proxy/load operation.
 */
protected Object proxyOrLoad(
		final LoadEvent event,
		final EntityPersister persister,
		final EntityKey keyToLoad,
		final LoadEventListener.LoadType options) {

	if ( LOG.isTraceEnabled() ) {
		LOG.tracev(
				"Loading entity: {0}",
				MessageHelper.infoString( persister, event.getEntityId(), event.getSession().getFactory() )
		);
	}

	// this class has no proxies (so do a shortcut)
	if ( !persister.hasProxy() ) {
		return load( event, persister, keyToLoad, options );
	}

	final PersistenceContext persistenceContext = event.getSession().getPersistenceContext();

	// look for a proxy
	Object proxy = persistenceContext.getProxy( keyToLoad );
	if ( proxy != null ) {
		return returnNarrowedProxy( event, persister, keyToLoad, options, persistenceContext, proxy );
	}

	if ( options.isAllowProxyCreation() ) {
		return createProxyIfNecessary( event, persister, keyToLoad, options, persistenceContext );
	}

	// return a newly loaded object
	return load( event, persister, keyToLoad, options );
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:45,代碼來源:DefaultLoadEventListener.java


注:本文中的org.hibernate.persister.entity.EntityPersister.hasProxy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。