org.hibernate.event.spi.RefreshEventListener Java Examples

The following examples show how to use org.hibernate.event.spi.RefreshEventListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SessionImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private void fireRefresh(RefreshEvent event) {
	try {
		if ( !getSessionFactory().getSessionFactoryOptions().isAllowRefreshDetachedEntity() ) {
			if ( event.getEntityName() != null ) {
				if ( !contains( event.getEntityName(), event.getObject() ) ) {
					throw new IllegalArgumentException( "Entity not managed" );
				}
			}
			else {
				if ( !contains( event.getObject() ) ) {
					throw new IllegalArgumentException( "Entity not managed" );
				}
			}
		}
		checkTransactionSynchStatus();
		for ( RefreshEventListener listener : listeners( EventType.REFRESH ) ) {
			listener.onRefresh( event );
		}
	}
	catch (RuntimeException e) {
		if ( !getSessionFactory().getSessionFactoryOptions().isJpaBootstrap() ) {
			if ( e instanceof HibernateException ) {
				throw e;
			}
		}
		//including HibernateException
		throw exceptionConverter.convert( e );
	}
	finally {
		delayedAfterCompletion();
	}
}
 
Example #2
Source File: SessionImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private void fireRefresh(Map refreshedAlready, RefreshEvent event) {
	try {
		checkTransactionSynchStatus();
		for ( RefreshEventListener listener : listeners( EventType.REFRESH ) ) {
			listener.onRefresh( event, refreshedAlready );
		}
		delayedAfterCompletion();
	}
	catch (RuntimeException e) {
		throw exceptionConverter.convert( e );
	}
	finally {
		delayedAfterCompletion();
	}
}