org.hibernate.event.spi.PostCommitUpdateEventListener Java Examples
The following examples show how to use
org.hibernate.event.spi.PostCommitUpdateEventListener.
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: PostCommitEventListenerGroupImpl.java From lams with GNU General Public License v2.0 | 6 votes |
public PostCommitEventListenerGroupImpl(EventType<T> eventType, EventListenerRegistryImpl listenerRegistry) { super( eventType, listenerRegistry ); if ( eventType == EventType.POST_COMMIT_DELETE ) { this.extendedListenerContract = PostCommitDeleteEventListener.class; } else if ( eventType == EventType.POST_COMMIT_INSERT ) { this.extendedListenerContract = PostCommitInsertEventListener.class; } else if ( eventType == EventType.POST_COMMIT_UPDATE ) { this.extendedListenerContract = PostCommitUpdateEventListener.class; } else { throw new IllegalStateException( "Unexpected usage of PostCommitEventListenerGroupImpl" ); } }
Example #2
Source File: EntityUpdateAction.java From lams with GNU General Public License v2.0 | 5 votes |
private void postCommitUpdate(boolean success) { final EventListenerGroup<PostUpdateEventListener> listenerGroup = listenerGroup( EventType.POST_COMMIT_UPDATE ); if ( listenerGroup.isEmpty() ) { return; } final PostUpdateEvent event = new PostUpdateEvent( getInstance(), getId(), state, previousState, dirtyFields, getPersister(), eventSource() ); for ( PostUpdateEventListener listener : listenerGroup.listeners() ) { if ( PostCommitUpdateEventListener.class.isInstance( listener ) ) { if ( success ) { listener.onPostUpdate( event ); } else { ((PostCommitUpdateEventListener) listener).onPostUpdateCommitFailed( event ); } } else { //default to the legacy implementation that always fires the event listener.onPostUpdate( event ); } } }