本文整理匯總了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;
}
}
}
示例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 );
}
示例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;
}
示例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 );
}