org.hibernate.event.spi.PostCommitInsertEventListener Java Examples
The following examples show how to use
org.hibernate.event.spi.PostCommitInsertEventListener.
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: EntityInsertAction.java From lams with GNU General Public License v2.0 | 5 votes |
private void postCommitInsert(boolean success) { final EventListenerGroup<PostInsertEventListener> listenerGroup = listenerGroup( EventType.POST_COMMIT_INSERT ); if ( listenerGroup.isEmpty() ) { return; } final PostInsertEvent event = new PostInsertEvent( getInstance(), getId(), getState(), getPersister(), eventSource() ); for ( PostInsertEventListener listener : listenerGroup.listeners() ) { if ( PostCommitInsertEventListener.class.isInstance( listener ) ) { if ( success ) { listener.onPostInsert( event ); } else { ((PostCommitInsertEventListener) listener).onPostInsertCommitFailed( event ); } } else { //default to the legacy implementation that always fires the event listener.onPostInsert( event ); } } }
Example #3
Source File: EntityIdentityInsertAction.java From lams with GNU General Public License v2.0 | 5 votes |
private void postCommitInsert(boolean success) { final EventListenerGroup<PostInsertEventListener> listenerGroup = listenerGroup( EventType.POST_COMMIT_INSERT ); if ( listenerGroup.isEmpty() ) { return; } final PostInsertEvent event = new PostInsertEvent( getInstance(), generatedId, getState(), getPersister(), eventSource() ); for ( PostInsertEventListener listener : listenerGroup.listeners() ) { if ( PostCommitInsertEventListener.class.isInstance( listener ) ) { if ( success ) { listener.onPostInsert( event ); } else { ((PostCommitInsertEventListener) listener).onPostInsertCommitFailed( event ); } } else { //default to the legacy implementation that always fires the event listener.onPostInsert( event ); } } }