session.getPersistenceContext().addUninitializedDetachedCollection( session.getFactory().getCollectionPersister( getRole() ), this
/** * 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 ); } }
private Session openTemporarySessionForLoading(PersistentCollection coll) { final SessionFactory sf = _sessionFactory; final Session session = sf.openSession(); PersistenceContext persistenceContext = ((SessionImplementor) session).getPersistenceContext(); persistenceContext.setDefaultReadOnly(true); session.setFlushMode(FlushMode.MANUAL); persistenceContext.addUninitializedDetachedCollection( ((SessionFactoryImplementor) _sessionFactory).getCollectionPersister(coll.getRole()), coll ); return session; }
private Session openTemporarySessionForLoading(PersistentCollection coll) { final SessionFactory sf = _sessionFactory; final Session session = sf.openSession(); PersistenceContext persistenceContext = ((SessionImplementor) session).getPersistenceContext(); persistenceContext.setDefaultReadOnly(true); session.setFlushMode(FlushMode.MANUAL); persistenceContext.addUninitializedDetachedCollection( ((SessionFactoryImplementor) _sessionFactory).getCollectionPersister(coll.getRole()), coll ); return session; }
private Session openTemporarySessionForLoading(PersistentCollection coll) { final SessionFactory sf = _sessionFactory; final Session session = sf.openSession(); PersistenceContext persistenceContext = ((SessionImplementor) session).getPersistenceContext(); persistenceContext.setDefaultReadOnly(true); session.setFlushMode(FlushMode.MANUAL); persistenceContext.addUninitializedDetachedCollection( ((SessionFactoryImplementor) _sessionFactory).getCollectionPersister(coll.getRole()), coll ); return session; }
private Session openTemporarySessionForLoading(PersistentCollection coll) { final SessionFactory sf = _sessionFactory; final Session session = sf.openSession(); PersistenceContext persistenceContext = ((SessionImplementor) session).getPersistenceContext(); persistenceContext.setDefaultReadOnly(true); session.setFlushMode(FlushMode.MANUAL); persistenceContext.addUninitializedDetachedCollection( ((SessionFactoryImplementor) _sessionFactory).getCollectionPersister(coll.getRole()), coll ); return session; }
session.getPersistenceContext().addUninitializedDetachedCollection( session.getFactory().getMetamodel().findCollectionDescriptor( getRole() ), this
/** * 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 ); } }