本文整理汇总了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;
}
}
示例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 );
}
示例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 );
}
}
}
示例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();
}