@Override public final boolean setCurrentSession(SharedSessionContractImplementor session) throws HibernateException { if ( session == this.session ) { return false; } else if ( this.session != null ) { final String msg = generateUnexpectedSessionStateMessage( session ); if ( isConnectedToSession() ) { throw new HibernateException( "Illegal attempt to associate a collection with two open sessions. " + msg ); } else { LOG.logUnexpectedSessionInCollectionNotConnected( msg ); } } if ( hasQueuedOperations() ) { LOG.queuedOperationWhenAttachToSession( MessageHelper.collectionInfoString( getRole(), getKey() ) ); } this.session = session; return true; }
session.getFactory().getCollectionPersister( getRole() ), this );
if ( !isTempSession ) { if ( hasQueuedOperations() ) { final String collectionInfoString = MessageHelper.collectionInfoString( getRole(), getKey() ); try { final TransactionStatus transactionStatus =
@Override public final boolean setCurrentSession(SharedSessionContractImplementor session) throws HibernateException { if ( session == this.session ) { assert collectionDescriptor != null; return false; } else if ( this.session != null ) { assert collectionDescriptor != null; final String msg = generateUnexpectedSessionStateMessage( session ); if ( isConnectedToSession() ) { throw new HibernateException( "Illegal attempt to associate a collection with two open sessions. " + msg ); } else { LOG.logUnexpectedSessionInCollectionNotConnected( msg ); this.collectionDescriptor = session.getFactory().getMetamodel().findCollectionDescriptor( getRole() ); } } if ( hasQueuedOperations() ) { LOG.queuedOperationWhenAttachToSession( MessageHelper.collectionInfoString( getRole(), getKey() ) ); } this.session = session; return true; }
session.getFactory().getMetamodel().findCollectionDescriptor( getRole() ), this );
if ( !isTempSession ) { if ( hasQueuedOperations() ) { final String collectionInfoString = MessageHelper.collectionInfoString( getRole(), getKey() ); try { final TransactionStatus transactionStatus =