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() );