Search in sources :

Example 1 with PersistEvent

use of org.hibernate.event.spi.PersistEvent in project hibernate-orm by hibernate.

the class SessionImpl method persist.

@Override
public void persist(Object object) throws HibernateException {
    checkOpen();
    firePersist(new PersistEvent(null, object, this));
}
Also used : PersistEvent(org.hibernate.event.spi.PersistEvent)

Example 2 with PersistEvent

use of org.hibernate.event.spi.PersistEvent 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();
}
Also used : PersistEventListener(org.hibernate.event.spi.PersistEventListener) EntityEntry(org.hibernate.engine.spi.EntityEntry) HibernateException(org.hibernate.HibernateException) PersistEvent(org.hibernate.event.spi.PersistEvent)

Example 3 with PersistEvent

use of org.hibernate.event.spi.PersistEvent in project hibernate-orm by hibernate.

the class SessionImpl method persist.

// persist() operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@Override
public void persist(String entityName, Object object) throws HibernateException {
    checkOpen();
    firePersist(new PersistEvent(entityName, object, this));
}
Also used : PersistEvent(org.hibernate.event.spi.PersistEvent)

Example 4 with PersistEvent

use of org.hibernate.event.spi.PersistEvent in project hibernate-orm by hibernate.

the class SessionImpl method persist.

@Override
public void persist(String entityName, Object object, Map copiedAlready) throws HibernateException {
    checkOpenOrWaitingForAutoClose();
    firePersist(copiedAlready, new PersistEvent(entityName, object, this));
}
Also used : PersistEvent(org.hibernate.event.spi.PersistEvent)

Aggregations

PersistEvent (org.hibernate.event.spi.PersistEvent)4 HibernateException (org.hibernate.HibernateException)1 EntityEntry (org.hibernate.engine.spi.EntityEntry)1 PersistEventListener (org.hibernate.event.spi.PersistEventListener)1