Code example for EventSource

Methods: getFactorygetPersistenceContext

0
 
		if ( collection == CollectionType.UNFETCHED_COLLECTION ) {
			return null; 
		} 
 
		EventSource session = getSession();
		CollectionPersister persister = session.getFactory().getCollectionPersister( type.getRole() );
 
		if ( isUpdate ) {
			removeCollection( persister, extractCollectionKeyFromOwner( persister ), session );
		} 
		if ( collection != null && ( collection instanceof PersistentCollection ) ) {
			PersistentCollection wrapper = ( PersistentCollection ) collection;
			wrapper.setCurrentSession( session );
			if ( wrapper.wasInitialized() ) {
				session.getPersistenceContext().addNewCollection( persister, wrapper );
			} 
			else { 
				reattachCollection( wrapper, type );
			} 
		} 
		else { 
			// otherwise a null or brand new collection 
			// this will also (inefficiently) handle arrays, which 
			// have no snapshot, so we can't do any better 
			//processArrayOrNewCollection(collection, type); 
		} 
 
		return null; 
 
	} 
 
}