use of org.hibernate.event.spi.DeleteEvent in project hibernate-orm by hibernate.
the class SessionImpl method delete.
@Override
@Deprecated
public void delete(String entityName, Object object) throws HibernateException {
checkOpen();
fireDelete(new DeleteEvent(entityName, object, this));
}
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, DeleteContext transientEntities) throws HibernateException {
checkOpenOrWaitingForAutoClose();
final boolean removingOrphanBeforeUpates = persistenceContext.isRemovingOrphanBeforeUpates();
final boolean traceEnabled = log.isTraceEnabled();
if (traceEnabled && removingOrphanBeforeUpates) {
logRemoveOrphanBeforeUpdates("before continuing", entityName, object);
}
fireDelete(new DeleteEvent(entityName, object, isCascadeDeleteEnabled, removingOrphanBeforeUpates, this), transientEntities);
if (traceEnabled && removingOrphanBeforeUpates) {
logRemoveOrphanBeforeUpdates("after continuing", entityName, object);
}
}
use of org.hibernate.event.spi.DeleteEvent in project hibernate-orm by hibernate.
the class SessionImpl method removeOrphanBeforeUpdates.
@Override
public void removeOrphanBeforeUpdates(String entityName, Object child) {
// TODO: The removeOrphan concept is a temporary "hack" for HHH-6484. This should be removed once action/task
// ordering is improved.
final boolean traceEnabled = log.isTraceEnabled();
if (traceEnabled) {
logRemoveOrphanBeforeUpdates("begin", entityName, child);
}
persistenceContext.beginRemoveOrphanBeforeUpdates();
try {
checkOpenOrWaitingForAutoClose();
fireDelete(new DeleteEvent(entityName, child, false, true, this));
} finally {
persistenceContext.endRemoveOrphanBeforeUpdates();
if (traceEnabled) {
logRemoveOrphanBeforeUpdates("end", entityName, child);
}
}
}
use of org.hibernate.event.spi.DeleteEvent in project hibernate-reactive by hibernate.
the class ReactiveSessionImpl method reactiveRemoveOrphanBeforeUpdates.
@Override
public CompletionStage<Void> reactiveRemoveOrphanBeforeUpdates(String entityName, Object child) {
// TODO: The removeOrphan concept is a temporary "hack" for HHH-6484. This should be removed once action/task
// ordering is improved.
final StatefulPersistenceContext persistenceContext = (StatefulPersistenceContext) getPersistenceContextInternal();
persistenceContext.beginRemoveOrphanBeforeUpdates();
return fireRemove(new DeleteEvent(entityName, child, false, true, this)).thenAccept(v -> {
persistenceContext.endRemoveOrphanBeforeUpdates();
if (log.isTraceEnabled()) {
logRemoveOrphanBeforeUpdates("end", entityName, child, persistenceContext);
}
});
}
use of org.hibernate.event.spi.DeleteEvent in project BridgeServer2 by Sage-Bionetworks.
the class TagEventListenerTest method onDeleteWithTransientEntities.
@Test
public void onDeleteWithTransientEntities() throws HibernateException {
DeleteEvent event = new DeleteEvent(new Tag("value"), null);
listener.onDelete(event, null);
verify(cacheProvider).removeObject(CacheKey.tagList());
}
Aggregations