use of org.hibernate.event.spi.PostInsertEvent in project hibernate-orm by hibernate.
the class EntityIdentityInsertAction method postCommitInsert.
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);
}
}
}
use of org.hibernate.event.spi.PostInsertEvent in project hibernate-orm by hibernate.
the class EntityInsertAction method postCommitInsert.
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);
}
}
}
Aggregations