/** * Reattach a detached (disassociated) initialized or uninitialized * collection wrapper, using a snapshot carried with the collection * wrapper */ protected void reattachCollection(PersistentCollection collection, CollectionType type) throws HibernateException { if ( collection.wasInitialized() ) { CollectionPersister collectionPersister = getSession().getFactory() .getCollectionPersister( type.getRole() ); getSession().getPersistenceContext() .addInitializedDetachedCollection( collectionPersister, collection ); } else { if ( !isCollectionSnapshotValid(collection) ) { throw new HibernateException( "could not reassociate uninitialized transient collection" ); } CollectionPersister collectionPersister = getSession().getFactory() .getCollectionPersister( collection.getRole() ); getSession().getPersistenceContext() .addUninitializedDetachedCollection( collectionPersister, collection ); } }
/** * Reattach a detached (disassociated) initialized or uninitialized * collection wrapper, using a snapshot carried with the collection * wrapper */ protected void reattachCollection(PersistentCollection collection, CollectionType type) throws HibernateException { if ( collection.wasInitialized() ) { CollectionPersister collectionPersister = getSession().getFactory() .getCollectionPersister( type.getRole() ); getSession().getPersistenceContext() .addInitializedDetachedCollection( collectionPersister, collection ); } else { if ( !isCollectionSnapshotValid(collection) ) { throw new HibernateException( "could not reassociate uninitialized transient collection" ); } CollectionPersister collectionPersister = getSession().getFactory() .getCollectionPersister( collection.getRole() ); getSession().getPersistenceContext() .addUninitializedDetachedCollection( collectionPersister, collection ); } }
/** * Reattach a detached (disassociated) initialized or uninitialized * collection wrapper, using a snapshot carried with the collection * wrapper */ protected void reattachCollection(PersistentCollection collection, CollectionType type) throws HibernateException { if ( collection.wasInitialized() ) { CollectionPersister collectionPersister = getSession().getFactory() .getCollectionPersister( type.getRole() ); getSession().getPersistenceContext() .addInitializedDetachedCollection( collectionPersister, collection ); } else { if ( !isCollectionSnapshotValid(collection) ) { throw new HibernateException( "could not reassociate uninitialized transient collection" ); } CollectionPersister collectionPersister = getSession().getFactory() .getCollectionPersister( collection.getRole() ); getSession().getPersistenceContext() .addUninitializedDetachedCollection( collectionPersister, collection ); } }
/** * Reattach a detached (disassociated) initialized or uninitialized * collection wrapper, using a snapshot carried with the collection * wrapper */ protected void reattachCollection(PersistentCollection collection, NavigableRole role) throws HibernateException { if ( collection.wasInitialized() ) { PersistentCollectionDescriptor collectionDescriptor = getSession().getFactory().getMetamodel() .findCollectionDescriptor( role.getFullPath() ); getSession().getPersistenceContext() .addInitializedDetachedCollection( collectionDescriptor, collection ); } else { if ( !isCollectionSnapshotValid(collection) ) { throw new HibernateException( "could not reassociate uninitialized transient collection" ); } PersistentCollectionDescriptor collectionDescriptor = getSession().getFactory().getMetamodel() .findCollectionDescriptor( collection.getRole() ); getSession().getPersistenceContext() .addUninitializedDetachedCollection( collectionDescriptor, collection ); } }