Hibernate ORM CollectionEntry - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM CollectionEntry class.

This code example shows how to use the following methods:getLoadedPersister, getSnapshot
	} 
 
	@Override 
	public void onPreRemoveCollection(PreCollectionRemoveEvent event) {
        CollectionEntry collectionEntry = getCollectionEntry( event );
        if ( collectionEntry != null && !collectionEntry.getLoadedPersister().isInverse() ) {
            onCollectionAction( event, null, collectionEntry.getSnapshot(), collectionEntry );
        } 
	} 
} 
6
CodeRank
This code example shows how to use the following methods:getCurrentKey, getCurrentPersister, getLoadedKey, getLoadedPersister, isDorecreate
		} 
		entry.setProcessed( true ); 
 
		final CollectionPersister loadedPersister = entry.getLoadedPersister(); 
		final CollectionPersister currentPersister = entry.getCurrentPersister(); 
		if ( loadedPersister != null || currentPersister != null ) {					// it is or was referenced _somewhere_ 
 
			boolean ownerChanged = loadedPersister != currentPersister ||				// if either its role changed, 
			                       !currentPersister 
					                       .getKeyType().isEqual(                       // or its key changed 
													entry.getLoadedKey(), 
			                                        entry.getCurrentKey(), 
			                                        factory 
			                       ); 
 
			if (ownerChanged) { 
 
				// do a check 
				final boolean orphanDeleteAndRoleChanged = loadedPersister != null && 
				                                           currentPersister != null && 

5
CodeRank
This code example shows how to use the following methods:getLoadedKey, getLoadedPersister
	} 
 
	private void evictCollection(PersistentCollection collection) { 
		CollectionEntry ce = (CollectionEntry) getSession().getPersistenceContext().getCollectionEntries().remove(collection); 
        if (LOG.isDebugEnabled()) LOG.debugf("Evicting collection: %s", 
                                             MessageHelper.collectionInfoString(ce.getLoadedPersister(), 
                                                                                ce.getLoadedKey(), 
                                                                                getSession().getFactory())); 
		if ( ce.getLoadedPersister() != null && ce.getLoadedKey() != null ) { 
			//TODO: is this 100% correct? 
			getSession().getPersistenceContext().getCollectionsByKey().remove( 
					new CollectionKey( ce.getLoadedPersister(), ce.getLoadedKey() ) 
			); 
		} 
	} 
} 

5
CodeRank
This code example shows how to use the following methods:getLoadedPersister
				getAffectedOwnerEntityName( collectionPersister, affectedOwner, source );
	} 
 
	protected static CollectionPersister getLoadedCollectionPersister( PersistentCollection collection, EventSource source ) {
		CollectionEntry ce = source.getPersistenceContext().getCollectionEntry( collection );
		return ( ce == null ? null : ce.getLoadedPersister() );		
	} 
 
	protected static Object getLoadedOwnerOrNull( PersistentCollection collection, EventSource source ) {
		return source.getPersistenceContext().getLoadedCollectionOwnerOrNull( collection );
	} 
 
	protected static Serializable getLoadedOwnerIdOrNull( PersistentCollection collection, EventSource source ) {
		return source.getPersistenceContext().getLoadedCollectionOwnerIdOrNull( collection );
	} 
 
	protected static Serializable getOwnerIdOrNull( Object owner, EventSource source ) {
		EntityEntry ownerEntry = source.getPersistenceContext().getEntry( owner );
		return ( ownerEntry == null ? null : ownerEntry.getId() );
	} 
5
CodeRank
This code example shows how to use the following methods:getLoadedPersister
	} 
 
	@Override 
	public void onPostRecreateCollection(PostCollectionRecreateEvent event) {
        CollectionEntry collectionEntry = getCollectionEntry( event );
        if ( ! collectionEntry.getLoadedPersister().isInverse() ) {
            onCollectionAction( event, event.getCollection(), null, collectionEntry );
        } 
	} 
} 
4
CodeRank
This code example shows how to use the following methods:getLoadedPersister
	} 
 
	@Override 
	public void onPreUpdateCollection(PreCollectionUpdateEvent event) {
        CollectionEntry collectionEntry = getCollectionEntry( event );
        if ( ! collectionEntry.getLoadedPersister().isInverse() ) {
            onCollectionAction( event, event.getCollection(), collectionEntry.getSnapshot(), collectionEntry );
        } 
	} 
} 
4
CodeRank
This code example shows how to use the following methods:getSnapshot
	} 
 
 
	/** 
	 * Get the <tt>PersistentCollection</tt> object for an array 
	 */ 
	public PersistentCollection getCollectionHolder(Object array) { 
		return (PersistentCollection) arrayHolders.get(array); 
	} 
 
	/** 
	 * Register a <tt>PersistentCollection</tt> object for an array. 
	 * Associates a holder with an array - MUST be called after loading 
	 * array, since the array instance is not created until endLoad(). 
	 */ 
	public void addCollectionHolder(PersistentCollection holder) { 
		//TODO:refactor + make this method private 
		arrayHolders.put( holder.getValue(), holder ); 
	} 
 
1
CodeRank