/** * Is this collection in a state that would allow us to * "queue" puts? This is a special case, because of orphan * delete. */ protected boolean isPutQueueEnabled() { return !initialized && isConnectedToSession() && isInverseOneToManyOrNoOrphanDelete(); } /**
/** * Is this collection in a state that would allow us to * "queue" operations? */ protected boolean isOperationQueueEnabled() { return !initialized && isConnectedToSession() && isInverseCollection(); } /**
/** * Is this collection in a state that would allow us to * "queue" clear? This is a special case, because of orphan * delete. */ protected boolean isClearQueueEnabled() { return !initialized && isConnectedToSession() && isInverseCollectionNoOrphanDelete(); }
/** * Associate the collection with the given session. * @return false if the collection was already associated with the session * @throws HibernateException if the collection was already associated * with another open session */ public final boolean setCurrentSession(SessionImplementor session) throws HibernateException { if (session==this.session) { return false; } else { if ( isConnectedToSession() ) { throw new HibernateException("Illegal attempt to associate a collection with two open sessions"); } else { this.session = session; return true; } } }
/** * Is this collection in a state that would allow us to * "queue" additions? */ private boolean isQueueAdditionEnabled() { return !initialized && isConnectedToSession() && session.getPersistenceContext().isInverseCollection(this); } /**
private void throwLazyInitializationExceptionIfNotConnected() { if ( !isConnectedToSession() ) { throwLazyInitializationException("no session or session was closed"); } if ( !session.isConnected() ) { throwLazyInitializationException("session is disconnected"); } }
/** * Initialize the collection, if possible, wrapping any exceptions * in a runtime exception * @param writing currently obsolete * @throws LazyInitializationException if we cannot initialize */ protected final void initialize(boolean writing) { if (!initialized) { if (initializing) { throw new LazyInitializationException("illegal access to loading collection"); } if ( isConnectedToSession() ) { if ( session.isConnected() ) { session.initializeCollection(this, writing); } else { throwLazyInitializationException("session is disconnected"); } } else { throwLazyInitializationException("no session or session was closed"); } } }
if ( isConnectedToSession() ) { CollectionEntry ce = session.getPersistenceContext().getCollectionEntry(this); if (ce==null) {