use of org.hibernate.event.spi.InitializeCollectionEvent in project hibernate-orm by hibernate.
the class SessionImpl method initializeCollection.
@Override
public void initializeCollection(PersistentCollection<?> collection, boolean writing) {
checkOpenOrWaitingForAutoClose();
pulseTransactionCoordinator();
InitializeCollectionEvent event = new InitializeCollectionEvent(collection, this);
fastSessionServices.eventListenerGroup_INIT_COLLECTION.fireEventOnEachListener(event, InitializeCollectionEventListener::onInitializeCollection);
delayedAfterCompletion();
}
use of org.hibernate.event.spi.InitializeCollectionEvent in project hibernate-reactive by hibernate.
the class ReactiveSessionImpl method reactiveInitializeCollection.
@Override
public CompletionStage<Void> reactiveInitializeCollection(PersistentCollection collection, boolean writing) {
checkOpenOrWaitingForAutoClose();
pulseTransactionCoordinator();
InitializeCollectionEvent event = new InitializeCollectionEvent(collection, this);
return fastSessionServices.eventListenerGroup_INIT_COLLECTION.fireEventOnEachListener(event, (DefaultReactiveInitializeCollectionEventListener l) -> l::onReactiveInitializeCollection).handle((v, e) -> {
delayedAfterCompletion();
if (e instanceof MappingException) {
throw getExceptionConverter().convert(new IllegalArgumentException(e.getMessage()));
} else if (e instanceof RuntimeException) {
throw getExceptionConverter().convert((RuntimeException) e);
}
return returnNullorRethrow(e);
});
}
use of org.hibernate.event.spi.InitializeCollectionEvent in project hibernate-orm by hibernate.
the class SessionImpl method initializeCollection.
@Override
public void initializeCollection(PersistentCollection collection, boolean writing) {
checkOpenOrWaitingForAutoClose();
checkTransactionSynchStatus();
InitializeCollectionEvent event = new InitializeCollectionEvent(collection, this);
for (InitializeCollectionEventListener listener : listeners(EventType.INIT_COLLECTION)) {
listener.onInitializeCollection(event);
}
delayedAfterCompletion();
}
Aggregations