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


Java EntityPersister.hasCollections方法代碼示例

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


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

示例1: wrapCollections

import org.hibernate.persister.entity.EntityPersister; //導入方法依賴的package包/類
private boolean wrapCollections(
		EventSource session,
		EntityPersister persister,
		Type[] types,
		Object[] values
) {
	if ( persister.hasCollections() ) {

		// wrap up any new collections directly referenced by the object
		// or its components

		// NOTE: we need to do the wrap here even if its not "dirty",
		// because collections need wrapping but changes to _them_
		// don't dirty the container. Also, for versioned data, we
		// need to wrap before calling searchForDirtyCollections

		WrapVisitor visitor = new WrapVisitor( session );
		// substitutes into values by side-effect
		visitor.processEntityPropertyValues( values, types );
		return visitor.isSubstitutionRequired();
	}
	else {
		return false;
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:26,代碼來源:DefaultFlushEntityEventListener.java

示例2: doEvict

import org.hibernate.persister.entity.EntityPersister; //導入方法依賴的package包/類
protected void doEvict(
		final Object object,
		final EntityKey key,
		final EntityPersister persister,
		final EventSource session)
		throws HibernateException {

	if ( LOG.isTraceEnabled() ) {
		LOG.tracev( "Evicting {0}", MessageHelper.infoString( persister ) );
	}

	if ( persister.hasNaturalIdentifier() ) {
		session.getPersistenceContext().getNaturalIdHelper().handleEviction(
				object,
				persister,
				key.getIdentifier()
		);
	}

	// remove all collections for the entity from the session-level cache
	if ( persister.hasCollections() ) {
		new EvictVisitor( session ).process( object, persister );
	}

	// remove any snapshot, not really for memory management purposes, but
	// rather because it might now be stale, and there is no longer any
	// EntityEntry to take precedence
	// This is now handled by removeEntity()
	//session.getPersistenceContext().removeDatabaseSnapshot(key);

	new Cascade( CascadingActions.EVICT, CascadePoint.AFTER_EVICT, session ).cascade( persister, object );
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:33,代碼來源:DefaultEvictEventListener.java

示例3: onFlushEntity

import org.hibernate.persister.entity.EntityPersister; //導入方法依賴的package包/類
/**
 * Flushes a single entity's state to the database, by scheduling
 * an update action, if necessary
 */
public void onFlushEntity(FlushEntityEvent event) throws HibernateException {
	final Object entity = event.getEntity();
	final EntityEntry entry = event.getEntityEntry();
	final EventSource session = event.getSession();
	final EntityPersister persister = entry.getPersister();
	final Status status = entry.getStatus();
	final Type[] types = persister.getPropertyTypes();

	final boolean mightBeDirty = entry.requiresDirtyCheck( entity );

	final Object[] values = getValues( entity, entry, mightBeDirty, session );

	event.setPropertyValues( values );

	//TODO: avoid this for non-new instances where mightBeDirty==false
	boolean substitute = wrapCollections( session, persister, types, values );

	if ( isUpdateNecessary( event, mightBeDirty ) ) {
		substitute = scheduleUpdate( event ) || substitute;
	}

	if ( status != Status.DELETED ) {
		// now update the object .. has to be outside the main if block above (because of collections)
		if ( substitute ) {
			persister.setPropertyValues( entity, values );
		}

		// Search for collections by reachability, updating their role.
		// We don't want to touch collections reachable from a deleted object
		if ( persister.hasCollections() ) {
			new FlushVisitor( session, entity ).processEntityPropertyValues( values, types );
		}
	}

}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:40,代碼來源:DefaultFlushEntityEventListener.java

示例4: isCollectionDirtyCheckNecessary

import org.hibernate.persister.entity.EntityPersister; //導入方法依賴的package包/類
private boolean isCollectionDirtyCheckNecessary(EntityPersister persister, Status status) {
	return ( status == Status.MANAGED || status == Status.READ_ONLY ) &&
			persister.isVersioned() &&
			persister.hasCollections();
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:6,代碼來源:DefaultFlushEntityEventListener.java


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