本文整理匯總了Java中org.hibernate.event.spi.PostCommitUpdateEventListener類的典型用法代碼示例。如果您正苦於以下問題:Java PostCommitUpdateEventListener類的具體用法?Java PostCommitUpdateEventListener怎麽用?Java PostCommitUpdateEventListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PostCommitUpdateEventListener類屬於org.hibernate.event.spi包,在下文中一共展示了PostCommitUpdateEventListener類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: PostCommitEventListenerGroupImpl
import org.hibernate.event.spi.PostCommitUpdateEventListener; //導入依賴的package包/類
public PostCommitEventListenerGroupImpl(EventType<T> eventType) {
super( eventType );
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" );
}
}
示例2: postCommitUpdate
import org.hibernate.event.spi.PostCommitUpdateEventListener; //導入依賴的package包/類
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 );
}
}
}
示例3: configure
import org.hibernate.event.spi.PostCommitUpdateEventListener; //導入依賴的package包/類
@Override
protected void configure() {
bind(TestEventListener.class)
.to(PostDeleteEventListener.class)
.to(PreDeleteEventListener.class)
.to(PreInsertEventListener.class)
.to(PostInsertEventListener.class)
.to(PreUpdateEventListener.class)
.to(PostUpdateEventListener.class)
.to(PostCommitInsertEventListener.class)
.to(PostCommitUpdateEventListener.class)
.to(PostCommitDeleteEventListener.class)
.in(PerThread.class);
}