/** * For uninitialized detached collections */ public CollectionEntry(PersistentCollectionDescriptor loadedDescriptor, Object loadedKey) { // detached collection wrappers that get found + reattached // during flush shouldn't be ignored ignore = false; //collection.clearDirty() this.loadedKey = loadedKey; setLoadedDescriptor( loadedDescriptor); }
/** * For collections just loaded from the database */ public CollectionEntry( final PersistentCollection collection, final PersistentCollectionDescriptor loadedDescriptor, final Object loadedKey, final boolean ignore) { this.ignore=ignore; //collection.clearDirty() this.loadedKey = loadedKey; setLoadedDescriptor( loadedDescriptor); collection.setSnapshot( loadedKey, loadedDescriptor.getNavigableRole(), null ); //postInitialize() will be called after initialization }
/** * For initialized detached collections */ public CollectionEntry(PersistentCollection collection, SessionFactoryImplementor factory) throws MappingException { // detached collections that get found + reattached // during flush shouldn't be ignored ignore = false; loadedKey = collection.getKey(); setLoadedDescriptor( factory.getMetamodel().findCollectionDescriptor( collection.getRole() ) ); snapshot = collection.getStoredSnapshot(); }
/** * Called after execution of an action */ public void afterAction(PersistentCollection collection) { loadedKey = getCurrentKey(); setLoadedDescriptor( getCurrentDescriptor() ); boolean resnapshot = collection.wasInitialized() && ( isDoremove() || isDorecreate() || isDoupdate() ); if ( resnapshot ) { snapshot = loadedCollectionDescriptor == null || !loadedCollectionDescriptor.getMutabilityPlan().isMutable() ? null //re-snapshot : collection.getSnapshot( loadedCollectionDescriptor ); } collection.postAction(); }