use of org.hibernate.event.spi.PersistEventListener in project hibernate-orm by hibernate.
the class SessionImpl method firePersistOnFlush.
private void firePersistOnFlush(Map copiedAlready, PersistEvent event) {
checkOpenOrWaitingForAutoClose();
checkTransactionSynchStatus();
for (PersistEventListener listener : listeners(EventType.PERSIST_ONFLUSH)) {
listener.onPersist(event, copiedAlready);
}
delayedAfterCompletion();
}
use of org.hibernate.event.spi.PersistEventListener in project hibernate-orm by hibernate.
the class SessionImpl method firePersist.
private void firePersist(PersistEvent event) {
try {
checkTransactionSynchStatus();
checkNoUnresolvedActionsBeforeOperation();
for (PersistEventListener listener : listeners(EventType.PERSIST)) {
listener.onPersist(event);
}
} catch (MappingException e) {
throw exceptionConverter.convert(new IllegalArgumentException(e.getMessage()));
} catch (RuntimeException e) {
throw exceptionConverter.convert(e);
} finally {
try {
checkNoUnresolvedActionsAfterOperation();
} catch (RuntimeException e) {
throw exceptionConverter.convert(e);
}
}
}
use of org.hibernate.event.spi.PersistEventListener in project hibernate-orm by hibernate.
the class AbstractEntityTuplizer method persistTransientEntity.
private static Serializable persistTransientEntity(Object entity, SharedSessionContractImplementor session) {
assert session != null;
LOG.debug("Performing implicit derived identity cascade");
final PersistEvent event = new PersistEvent(null, entity, (EventSource) session);
for (PersistEventListener listener : persistEventListeners(session)) {
listener.onPersist(event);
}
final EntityEntry pcEntry = session.getPersistenceContext().getEntry(entity);
if (pcEntry == null || pcEntry.getId() == null) {
throw new HibernateException("Unable to process implicit derived identity cascade");
}
return pcEntry.getId();
}
use of org.hibernate.event.spi.PersistEventListener in project hibernate-orm by hibernate.
the class SessionImpl method firePersistOnFlush.
private void firePersistOnFlush(PersistEvent event) {
checkOpen();
checkTransactionSynchStatus();
checkNoUnresolvedActionsBeforeOperation();
for (PersistEventListener listener : listeners(EventType.PERSIST_ONFLUSH)) {
listener.onPersist(event);
}
checkNoUnresolvedActionsAfterOperation();
}
Aggregations