protected PersistentCollectionDescriptor resolveCollectionDescriptor( SessionImplementor session, PersistentCollection collection) { // First attempt to resolve the descriptor from the collection entry if ( collection != null ) { CollectionEntry collectionEntry = session.getPersistenceContext().getCollectionEntry( collection ); if ( collectionEntry != null ) { PersistentCollectionDescriptor descriptor = collectionEntry.getCurrentDescriptor(); if ( descriptor != null ) { return descriptor; } } } // Fallback to resolving the descripto from the collection role final PersistentCollectionDescriptor descriptor = session.getFactory() .getMetamodel() .getCollectionDescriptor( commonCollectionMapperData.getRole() ); if ( descriptor == null ) { throw new AuditException( String.format( Locale.ROOT, "Failed to locate PersistentCollectionDescriptor for collection [%s].", commonCollectionMapperData.getRole() ) ); } return descriptor; }
/** * 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(); }
new CollectionRecreateAction( coll, ce.getCurrentDescriptor(), ce.getCurrentKey(), session
final PersistentCollectionDescriptor currentDescriptor = entry.getCurrentDescriptor(); if ( loadedDescriptor != null || currentDescriptor != null ) {