Code example for PersistenceContext

Methods: getSessionremoveEntry

0
				final Object entity = persistenceContext.removeEntity( key ); 
				if ( entity != null ) { 
					EntityEntry e = event.getSession().getPersistenceContext().removeEntry( entity ); 
					doEvict( entity, key, e.getPersister(), event.getSession() ); 
				} 
			} 
			li.unsetSession(); 
		} 
		else { 
			EntityEntry e = persistenceContext.removeEntry( object ); 
			if ( e != null ) { 
				persistenceContext.removeEntity( e.getEntityKey() ); 
				doEvict( object, e.getEntityKey(), e.getPersister(), source ); 
			} 
		} 
	} 
 
	protected void doEvict( 
		final Object object, 
		final EntityKey key, 
		final EntityPersister persister, 
		final EventSource session) 
	throws HibernateException { 
 
        if (LOG.isTraceEnabled()) LOG.trace("Evicting " + MessageHelper.infoString(persister)); 
 
		// remove all collections for the entity from the session-level cache 
		if ( persister.hasCollections() ) { 
			new EvictVisitor( session ).process( object, persister ); 
		}