Search in sources :

Example 6 with DeleteEvent

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

the class SessionImpl method delete.

@Override
public void delete(String entityName, Object object, boolean isCascadeDeleteEnabled, Set transientEntities) throws HibernateException {
    checkOpenOrWaitingForAutoClose();
    if (TRACE_ENABLED && persistenceContext.isRemovingOrphanBeforeUpates()) {
        logRemoveOrphanBeforeUpdates("before continuing", entityName, object);
    }
    fireDelete(new DeleteEvent(entityName, object, isCascadeDeleteEnabled, persistenceContext.isRemovingOrphanBeforeUpates(), this), transientEntities);
    if (TRACE_ENABLED && persistenceContext.isRemovingOrphanBeforeUpates()) {
        logRemoveOrphanBeforeUpdates("after continuing", entityName, object);
    }
}
Also used : DeleteEvent(org.hibernate.event.spi.DeleteEvent)

Example 7 with DeleteEvent

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

the class SessionImpl method delete.

// delete() operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@Override
@Deprecated
public void delete(Object object) throws HibernateException {
    checkOpen();
    fireDelete(new DeleteEvent(object, this));
}
Also used : DeleteEvent(org.hibernate.event.spi.DeleteEvent)

Example 8 with DeleteEvent

use of org.hibernate.event.spi.DeleteEvent in project BridgeServer2 by Sage-Bionetworks.

the class TagEventListenerTest method onDeleteWithTransientEntitiesNotTag.

@Test
public void onDeleteWithTransientEntitiesNotTag() throws HibernateException {
    DeleteEvent event = new DeleteEvent(new HibernateAssessment(), null);
    listener.onDelete(event, null);
    verify(cacheProvider, never()).removeObject(CacheKey.tagList());
}
Also used : DeleteEvent(org.hibernate.event.spi.DeleteEvent) HibernateAssessment(org.sagebionetworks.bridge.models.assessments.HibernateAssessment) Test(org.testng.annotations.Test)

Example 9 with DeleteEvent

use of org.hibernate.event.spi.DeleteEvent in project BridgeServer2 by Sage-Bionetworks.

the class TagEventListenerTest method onDelete.

@Test
public void onDelete() throws HibernateException {
    DeleteEvent event = new DeleteEvent(new Tag("value"), null);
    listener.onDelete(event);
    verify(cacheProvider).removeObject(CacheKey.tagList());
}
Also used : DeleteEvent(org.hibernate.event.spi.DeleteEvent) Tag(org.sagebionetworks.bridge.models.Tag) Test(org.testng.annotations.Test)

Example 10 with DeleteEvent

use of org.hibernate.event.spi.DeleteEvent in project BridgeServer2 by Sage-Bionetworks.

the class TagEventListenerTest method onDeleteNotTag.

@Test
public void onDeleteNotTag() throws HibernateException {
    DeleteEvent event = new DeleteEvent(new HibernateAssessment(), null);
    listener.onDelete(event);
    verify(cacheProvider, never()).removeObject(CacheKey.tagList());
}
Also used : DeleteEvent(org.hibernate.event.spi.DeleteEvent) HibernateAssessment(org.sagebionetworks.bridge.models.assessments.HibernateAssessment) Test(org.testng.annotations.Test)

Aggregations

DeleteEvent (org.hibernate.event.spi.DeleteEvent)10 Test (org.testng.annotations.Test)4 Tag (org.sagebionetworks.bridge.models.Tag)2 HibernateAssessment (org.sagebionetworks.bridge.models.assessments.HibernateAssessment)2 StatefulPersistenceContext (org.hibernate.engine.internal.StatefulPersistenceContext)1