类org.hibernate.event.spi.PostCommitInsertEventListener源码实例Demo

下面列出了怎么用org.hibernate.event.spi.PostCommitInsertEventListener的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: lams   文件: PostCommitEventListenerGroupImpl.java
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" );
	}
}
 
源代码2 项目: lams   文件: EntityInsertAction.java
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 );
		}
	}
}
 
源代码3 项目: lams   文件: EntityIdentityInsertAction.java
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 );
		}
	}
}
 
 类所在包
 类方法
 同包方法