org.hibernate.event.spi.PostCommitDeleteEventListener Java Examples
The following examples show how to use
org.hibernate.event.spi.PostCommitDeleteEventListener.
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: EntityDeleteAction.java From lams with GNU General Public License v2.0 | 5 votes |
private void postCommitDelete(boolean success) { final EventListenerGroup<PostDeleteEventListener> listenerGroup = listenerGroup( EventType.POST_COMMIT_DELETE ); if ( listenerGroup.isEmpty() ) { return; } final PostDeleteEvent event = new PostDeleteEvent( getInstance(), getId(), state, getPersister(), eventSource() ); for ( PostDeleteEventListener listener : listenerGroup.listeners() ) { if ( PostCommitDeleteEventListener.class.isInstance( listener ) ) { if ( success ) { listener.onPostDelete( event ); } else { ((PostCommitDeleteEventListener) listener).onPostDeleteCommitFailed( event ); } } else { //default to the legacy implementation that always fires the event listener.onPostDelete( event ); } } }