HHH-18942 JFR events for stateless sessions

also add Statistics for upsert
This commit is contained in:
Gavin King 2024-12-15 17:34:15 +01:00
parent caed673720
commit d3ce8d45ea
10 changed files with 267 additions and 72 deletions

View File

@ -266,6 +266,16 @@ public void completeEntityUpdateEvent(
} }
@Override
public HibernateMonitoringEvent beginEntityUpsertEvent() {
return null;
}
@Override
public void completeEntityUpsertEvent(HibernateMonitoringEvent event, Object id, String entityName, boolean success, SharedSessionContractImplementor session) {
}
@Override @Override
public HibernateMonitoringEvent beginEntityDeleteEvent() { public HibernateMonitoringEvent beginEntityDeleteEvent() {
return null; return null;

View File

@ -165,6 +165,10 @@ void completePrePartialFlush(
void completeEntityUpdateEvent(HibernateMonitoringEvent event, Object id, String entityName, boolean success, SharedSessionContractImplementor session); void completeEntityUpdateEvent(HibernateMonitoringEvent event, Object id, String entityName, boolean success, SharedSessionContractImplementor session);
HibernateMonitoringEvent beginEntityUpsertEvent();
void completeEntityUpsertEvent(HibernateMonitoringEvent event, Object id, String entityName, boolean success, SharedSessionContractImplementor session);
HibernateMonitoringEvent beginEntityDeleteEvent(); HibernateMonitoringEvent beginEntityDeleteEvent();
void completeEntityDeleteEvent(HibernateMonitoringEvent event, Object id, String entityName, boolean success, SharedSessionContractImplementor session); void completeEntityDeleteEvent(HibernateMonitoringEvent event, Object id, String entityName, boolean success, SharedSessionContractImplementor session);

View File

@ -799,7 +799,7 @@ Statements prepared (closed): %s (%s)
Second-level cache hits (misses): %s (%s) Second-level cache hits (misses): %s (%s)
Entities loaded: %s Entities loaded: %s
Entities fetched: %s (minimize this) Entities fetched: %s (minimize this)
Entities updated, inserted, deleted: %s, %s, %s Entities updated, upserted, inserted, deleted: %s, %s, %s, %s
Collections loaded: %s Collections loaded: %s
Collections fetched: %s (minimize this) Collections fetched: %s (minimize this)
Collections updated, removed, recreated: %s, %s, %s Collections updated, removed, recreated: %s, %s, %s
@ -833,6 +833,7 @@ void logStatistics(
long entityLoadCount, long entityLoadCount,
long entityFetchCount, long entityFetchCount,
long entityUpdateCount, long entityUpdateCount,
long entityUpsertCount,
long entityInsertCount, long entityInsertCount,
long entityDeleteCount, long entityDeleteCount,
long collectionLoadCount, long collectionLoadCount,

View File

@ -31,6 +31,8 @@
import org.hibernate.engine.spi.PersistenceContext; import org.hibernate.engine.spi.PersistenceContext;
import org.hibernate.engine.transaction.internal.jta.JtaStatusHelper; import org.hibernate.engine.transaction.internal.jta.JtaStatusHelper;
import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform; import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform;
import org.hibernate.event.spi.EventManager;
import org.hibernate.event.spi.HibernateMonitoringEvent;
import org.hibernate.event.spi.PostDeleteEvent; import org.hibernate.event.spi.PostDeleteEvent;
import org.hibernate.event.spi.PostDeleteEventListener; import org.hibernate.event.spi.PostDeleteEventListener;
import org.hibernate.event.spi.PostInsertEvent; import org.hibernate.event.spi.PostInsertEvent;
@ -184,17 +186,19 @@ else if ( generator.generatedOnExecution( entity, this ) ) {
} }
else { else {
getInterceptor().onInsert( entity, id, state, persister.getPropertyNames(), persister.getPropertyTypes() ); getInterceptor().onInsert( entity, id, state, persister.getPropertyNames(), persister.getPropertyTypes() );
final EventManager eventManager = getEventManager();
final HibernateMonitoringEvent event = eventManager.beginEntityInsertEvent();
boolean success = false;
try {
persister.getInsertCoordinator().insert( entity, id, state, this ); persister.getInsertCoordinator().insert( entity, id, state, this );
success = true;
}
finally {
eventManager.completeEntityInsertEvent( event, id, persister.getEntityName(), success, this );
} }
} }
forEachOwnedCollection( entity, id, persister,
(descriptor, collection) -> {
descriptor.recreate( collection, id, this);
final StatisticsImplementor statistics = getFactory().getStatistics();
if ( statistics.isStatisticsEnabled() ) {
statistics.recreateCollection( descriptor.getRole() );
} }
} ); recreateCollections( entity, id, persister );
firePostInsert(entity, id, state, persister); firePostInsert(entity, id, state, persister);
final StatisticsImplementor statistics = getFactory().getStatistics(); final StatisticsImplementor statistics = getFactory().getStatistics();
if ( statistics.isStatisticsEnabled() ) { if ( statistics.isStatisticsEnabled() ) {
@ -203,6 +207,26 @@ else if ( generator.generatedOnExecution( entity, this ) ) {
return id; return id;
} }
private void recreateCollections(Object entity, Object id, EntityPersister persister) {
forEachOwnedCollection( entity, id, persister,
(descriptor, collection) -> {
final EventManager eventManager = getEventManager();
final HibernateMonitoringEvent event = eventManager.beginCollectionRecreateEvent();
boolean success = false;
try {
descriptor.recreate( collection, id, this );
success = true;
}
finally {
eventManager.completeCollectionRecreateEvent( event, id, descriptor.getRole(), success, this );
}
final StatisticsImplementor statistics = getFactory().getStatistics();
if ( statistics.isStatisticsEnabled() ) {
statistics.recreateCollection( descriptor.getRole() );
}
} );
}
// deletes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // deletes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@Override @Override
@ -231,17 +255,18 @@ public void delete(String entityName, Object entity) {
final Object id = persister.getIdentifier( entity, this ); final Object id = persister.getIdentifier( entity, this );
final Object version = persister.getVersion( entity ); final Object version = persister.getVersion( entity );
if ( !firePreDelete(entity, id, persister) ) { if ( !firePreDelete(entity, id, persister) ) {
getInterceptor() getInterceptor().onDelete( entity, id, persister.getPropertyNames(), persister.getPropertyTypes() );
.onDelete( entity, id, persister.getPropertyNames(), persister.getPropertyTypes() ); removeCollections( entity, id, persister );
forEachOwnedCollection( entity, id, persister, final EventManager eventManager = getEventManager();
(descriptor, collection) -> { final HibernateMonitoringEvent event = eventManager.beginEntityDeleteEvent();
descriptor.remove( id, this ); boolean success = false;
final StatisticsImplementor statistics = getFactory().getStatistics(); try {
if ( statistics.isStatisticsEnabled() ) {
statistics.removeCollection( descriptor.getRole() );
}
} );
persister.getDeleteCoordinator().delete( entity, id, version, this ); persister.getDeleteCoordinator().delete( entity, id, version, this );
success = true;
}
finally {
eventManager.completeEntityDeleteEvent( event, id, persister.getEntityName(), success, this );
}
firePostDelete(entity, id, persister); firePostDelete(entity, id, persister);
final StatisticsImplementor statistics = getFactory().getStatistics(); final StatisticsImplementor statistics = getFactory().getStatistics();
if ( statistics.isStatisticsEnabled() ) { if ( statistics.isStatisticsEnabled() ) {
@ -250,6 +275,27 @@ public void delete(String entityName, Object entity) {
} }
} }
private void removeCollections(Object entity, Object id, EntityPersister persister) {
forEachOwnedCollection( entity, id, persister,
(descriptor, collection) -> {
final EventManager eventManager = getEventManager();
final HibernateMonitoringEvent event = eventManager.beginCollectionRemoveEvent();
boolean success = false;
try {
descriptor.remove( id, this );
success = true;
}
finally {
eventManager.completeCollectionRemoveEvent( event, id, descriptor.getRole(), success, this );
}
final StatisticsImplementor statistics = getFactory().getStatistics();
if ( statistics.isStatisticsEnabled() ) {
statistics.removeCollection( descriptor.getRole() );
}
} );
}
// updates ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // updates ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -289,19 +335,18 @@ public void update(String entityName, Object entity) {
oldVersion = null; oldVersion = null;
} }
if ( !firePreUpdate(entity, id, state, persister) ) { if ( !firePreUpdate(entity, id, state, persister) ) {
getInterceptor() getInterceptor().onUpdate( entity, id, state, persister.getPropertyNames(), persister.getPropertyTypes() );
.onUpdate( entity, id, state, persister.getPropertyNames(), persister.getPropertyTypes() ); final EventManager eventManager = getEventManager();
final HibernateMonitoringEvent event = eventManager.beginEntityUpdateEvent();
boolean success = false;
try {
persister.getUpdateCoordinator().update( entity, id, null, state, oldVersion, null, null, false, this ); persister.getUpdateCoordinator().update( entity, id, null, state, oldVersion, null, null, false, this );
forEachOwnedCollection( entity, id, persister, success = true;
(descriptor, collection) -> {
// TODO: can we do better here?
descriptor.remove( id, this );
descriptor.recreate( collection, id, this );
final StatisticsImplementor statistics = getFactory().getStatistics();
if ( statistics.isStatisticsEnabled() ) {
statistics.updateCollection( descriptor.getRole() );
} }
} ); finally {
eventManager.completeEntityUpdateEvent( event, id, persister.getEntityName(), success, this );
}
removeAndRecreateCollections( entity, id, persister );
firePostUpdate(entity, id, state, persister); firePostUpdate(entity, id, state, persister);
final StatisticsImplementor statistics = getFactory().getStatistics(); final StatisticsImplementor statistics = getFactory().getStatistics();
if ( statistics.isStatisticsEnabled() ) { if ( statistics.isStatisticsEnabled() ) {
@ -310,6 +355,28 @@ public void update(String entityName, Object entity) {
} }
} }
private void removeAndRecreateCollections(Object entity, Object id, EntityPersister persister) {
forEachOwnedCollection( entity, id, persister,
(descriptor, collection) -> {
final EventManager eventManager = getEventManager();
final HibernateMonitoringEvent event = eventManager.beginCollectionRemoveEvent();
boolean success = false;
try {
// TODO: can we do better here?
descriptor.remove( id, this );
descriptor.recreate( collection, id, this );
success = true;
}
finally {
eventManager.completeCollectionRemoveEvent( event, id, descriptor.getRole(), success, this );
}
final StatisticsImplementor statistics = getFactory().getStatistics();
if ( statistics.isStatisticsEnabled() ) {
statistics.updateCollection( descriptor.getRole() );
}
} );
}
@Override @Override
public void upsert(Object entity) { public void upsert(Object entity) {
upsert( null, entity ); upsert( null, entity );
@ -336,21 +403,23 @@ public void upsert(String entityName, Object entity) {
final Object id = idToUpsert( entity, persister ); final Object id = idToUpsert( entity, persister );
final Object[] state = persister.getValues( entity ); final Object[] state = persister.getValues( entity );
if ( !firePreUpsert(entity, id, state, persister) ) { if ( !firePreUpsert(entity, id, state, persister) ) {
getInterceptor() getInterceptor().onUpsert( entity, id, state, persister.getPropertyNames(), persister.getPropertyTypes() );
.onUpsert( entity, id, state, persister.getPropertyNames(), persister.getPropertyTypes() );
final Object oldVersion = versionToUpsert( entity, persister, state ); final Object oldVersion = versionToUpsert( entity, persister, state );
final EventManager eventManager = getEventManager();
final HibernateMonitoringEvent event = eventManager.beginEntityUpsertEvent();
boolean success = false;
try {
persister.getMergeCoordinator().update( entity, id, null, state, oldVersion, null, null, false, this ); persister.getMergeCoordinator().update( entity, id, null, state, oldVersion, null, null, false, this );
// TODO: statistics for upsert! success = true;
forEachOwnedCollection( entity, id, persister, }
(descriptor, collection) -> { finally {
// TODO: can we do better here? eventManager.completeEntityUpsertEvent( event, id, persister.getEntityName(), success, this );
descriptor.remove( id, this ); }
descriptor.recreate( collection, id, this );
final StatisticsImplementor statistics = getFactory().getStatistics(); final StatisticsImplementor statistics = getFactory().getStatistics();
if ( statistics.isStatisticsEnabled() ) { if ( statistics.isStatisticsEnabled() ) {
statistics.updateCollection( descriptor.getRole() ); statistics.upsertEntity( persister.getEntityName() );
} }
} ); removeAndRecreateCollections( entity, id, persister );
firePostUpsert(entity, id, state, persister); firePostUpsert(entity, id, state, persister);
} }
} }

View File

@ -156,6 +156,11 @@ public interface Statistics {
*/ */
long getEntityUpdateCount(); long getEntityUpdateCount();
/**
* The global number of entity upserts.
*/
long getEntityUpsertCount();
/** /**
* The global number of executed queries. * The global number of executed queries.
*/ */

View File

@ -20,6 +20,7 @@ public class EntityStatisticsImpl extends AbstractCacheableDataStatistics implem
private final String rootEntityName; private final String rootEntityName;
private final LongAdder loadCount = new LongAdder(); private final LongAdder loadCount = new LongAdder();
private final LongAdder updateCount = new LongAdder(); private final LongAdder updateCount = new LongAdder();
private final LongAdder upsertCount = new LongAdder();
private final LongAdder insertCount = new LongAdder(); private final LongAdder insertCount = new LongAdder();
private final LongAdder deleteCount = new LongAdder(); private final LongAdder deleteCount = new LongAdder();
private final LongAdder fetchCount = new LongAdder(); private final LongAdder fetchCount = new LongAdder();
@ -50,6 +51,10 @@ public long getUpdateCount() {
return updateCount.sum(); return updateCount.sum();
} }
public long getUpsertCount() {
return upsertCount.sum();
}
public long getFetchCount() { public long getFetchCount() {
return fetchCount.sum(); return fetchCount.sum();
} }
@ -70,6 +75,10 @@ void incrementUpdateCount() {
updateCount.increment(); updateCount.increment();
} }
void incrementUpsertCount() {
upsertCount.increment();
}
void incrementInsertCount() { void incrementInsertCount() {
insertCount.increment(); insertCount.increment();
} }
@ -88,6 +97,7 @@ public String toString() {
.append( "[rootEntityName=" ).append( rootEntityName ) .append( "[rootEntityName=" ).append( rootEntityName )
.append( ",loadCount=" ).append( this.loadCount ) .append( ",loadCount=" ).append( this.loadCount )
.append( ",updateCount=" ).append( this.updateCount ) .append( ",updateCount=" ).append( this.updateCount )
.append( ",upsertCount=" ).append( this.upsertCount )
.append( ",insertCount=" ).append( this.insertCount ) .append( ",insertCount=" ).append( this.insertCount )
.append( ",deleteCount=" ).append( this.deleteCount ) .append( ",deleteCount=" ).append( this.deleteCount )
.append( ",fetchCount=" ).append( this.fetchCount ) .append( ",fetchCount=" ).append( this.fetchCount )

View File

@ -66,6 +66,7 @@ public class StatisticsImpl implements StatisticsImplementor, Service {
private final LongAdder entityLoadCount = new LongAdder(); private final LongAdder entityLoadCount = new LongAdder();
private final LongAdder entityUpdateCount = new LongAdder(); private final LongAdder entityUpdateCount = new LongAdder();
private final LongAdder entityUpsertCount = new LongAdder();
private final LongAdder entityInsertCount = new LongAdder(); private final LongAdder entityInsertCount = new LongAdder();
private final LongAdder entityDeleteCount = new LongAdder(); private final LongAdder entityDeleteCount = new LongAdder();
private final LongAdder entityFetchCount = new LongAdder(); private final LongAdder entityFetchCount = new LongAdder();
@ -174,6 +175,7 @@ public void clear() {
entityDeleteCount.reset(); entityDeleteCount.reset();
entityInsertCount.reset(); entityInsertCount.reset();
entityUpdateCount.reset(); entityUpdateCount.reset();
entityUpsertCount.reset();
entityLoadCount.reset(); entityLoadCount.reset();
entityFetchCount.reset(); entityFetchCount.reset();
@ -280,6 +282,11 @@ public long getEntityUpdateCount() {
return entityUpdateCount.sum(); return entityUpdateCount.sum();
} }
@Override
public long getEntityUpsertCount() {
return entityUpsertCount.sum();
}
@Override @Override
public long getOptimisticFailureCount() { public long getOptimisticFailureCount() {
return optimisticFailureCount.sum(); return optimisticFailureCount.sum();
@ -303,6 +310,12 @@ public void updateEntity(String entityName) {
getEntityStatistics( entityName ).incrementUpdateCount(); getEntityStatistics( entityName ).incrementUpdateCount();
} }
@Override
public void upsertEntity(String entityName) {
entityUpsertCount.increment();
getEntityStatistics( entityName ).incrementUpsertCount();
}
@Override @Override
public void insertEntity(String entityName) { public void insertEntity(String entityName) {
entityInsertCount.increment(); entityInsertCount.increment();
@ -901,6 +914,7 @@ public void logSummary() {
entityLoadCount.sum(), entityLoadCount.sum(),
entityFetchCount.sum(), entityFetchCount.sum(),
entityUpdateCount.sum(), entityUpdateCount.sum(),
entityUpsertCount.sum(),
entityInsertCount.sum(), entityInsertCount.sum(),
entityDeleteCount.sum(), entityDeleteCount.sum(),
collectionLoadCount.sum(), collectionLoadCount.sum(),
@ -944,6 +958,7 @@ public String toString() {
",second level cache misses=" + secondLevelCacheMissCount + ",second level cache misses=" + secondLevelCacheMissCount +
",entities loaded=" + entityLoadCount + ",entities loaded=" + entityLoadCount +
",entities updated=" + entityUpdateCount + ",entities updated=" + entityUpdateCount +
",entities upserted=" + entityUpsertCount +
",entities inserted=" + entityInsertCount + ",entities inserted=" + entityInsertCount +
",entities deleted=" + entityDeleteCount + ",entities deleted=" + entityDeleteCount +
",entities fetched=" + entityFetchCount + ",entities fetched=" + entityFetchCount +

View File

@ -80,6 +80,13 @@ public interface StatisticsImplementor extends Statistics, Service {
*/ */
void updateEntity(String entityName); void updateEntity(String entityName);
/**
* Callback about an entity being upserted.
*
* @param entityName The name of the entity upserted.
*/
void upsertEntity(String entityName);
/** /**
* Callback about an entity being inserted * Callback about an entity being inserted
* *

View File

@ -0,0 +1,42 @@
/*
* SPDX-License-Identifier: LGPL-2.1-or-later
* Copyright Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.event.jfr.internal;
import jdk.jfr.Category;
import jdk.jfr.Description;
import jdk.jfr.Event;
import jdk.jfr.Label;
import jdk.jfr.Name;
import jdk.jfr.StackTrace;
import org.hibernate.event.spi.HibernateMonitoringEvent;
import org.hibernate.internal.build.AllowNonPortable;
@Name(EntityUpsertEvent.NAME)
@Label("Entity Upsert")
@Category("Hibernate ORM")
@Description("Entity Upsert")
@StackTrace
@AllowNonPortable
public class EntityUpsertEvent extends Event implements HibernateMonitoringEvent {
public static final String NAME = "org.hibernate.orm.EntityUpsertEvent";
@Label("Session Identifier")
public String sessionIdentifier;
@Label("Entity Identifier")
public String id;
@Label("Entity Name")
public String entityName;
@Label("Success")
public boolean success;
@Override
public String toString() {
return NAME;
}
}

View File

@ -43,6 +43,7 @@ public class JfrEventManager implements EventManager {
private static final EventType prePartialFlushEventType = EventType.getEventType( PrePartialFlushEvent.class ); private static final EventType prePartialFlushEventType = EventType.getEventType( PrePartialFlushEvent.class );
private static final EventType entityInsertEventType = EventType.getEventType( EntityInsertEvent.class ); private static final EventType entityInsertEventType = EventType.getEventType( EntityInsertEvent.class );
private static final EventType entityUpdateEventType = EventType.getEventType( EntityUpdateEvent.class ); private static final EventType entityUpdateEventType = EventType.getEventType( EntityUpdateEvent.class );
private static final EventType entityUpsertEventType = EventType.getEventType( EntityUpsertEvent.class );
private static final EventType entityDeleteEventType = EventType.getEventType( EntityDeleteEvent.class ); private static final EventType entityDeleteEventType = EventType.getEventType( EntityDeleteEvent.class );
private static final EventType collectionRecreateEventType = EventType.getEventType( CollectionRecreateEvent.class ); private static final EventType collectionRecreateEventType = EventType.getEventType( CollectionRecreateEvent.class );
private static final EventType collectionUpdateEventType = EventType.getEventType( CollectionUpdateEvent.class ); private static final EventType collectionUpdateEventType = EventType.getEventType( CollectionUpdateEvent.class );
@ -593,6 +594,37 @@ public void completeEntityUpdateEvent(
} }
} }
@Override
public HibernateMonitoringEvent beginEntityUpsertEvent() {
if ( entityUpsertEventType.isEnabled() ) {
final EntityUpsertEvent event = new EntityUpsertEvent();
event.begin();
return event;
}
else {
return null;
}
}
@Override
public void completeEntityUpsertEvent(
HibernateMonitoringEvent event,
Object id, String entityName,
boolean success,
SharedSessionContractImplementor session) {
if ( event != null ) {
final EntityUpsertEvent entityUpsertEvent = (EntityUpsertEvent) event;
entityUpsertEvent.end();
if ( entityUpsertEvent.shouldCommit() ) {
entityUpsertEvent.sessionIdentifier = getSessionIdentifier( session );
entityUpsertEvent.entityName = entityName;
entityUpsertEvent.id = Objects.toString(id);
entityUpsertEvent.success = success;
entityUpsertEvent.commit();
}
}
}
@Override @Override
public HibernateMonitoringEvent beginEntityDeleteEvent() { public HibernateMonitoringEvent beginEntityDeleteEvent() {
if ( entityDeleteEventType.isEnabled() ) { if ( entityDeleteEventType.isEnabled() ) {
@ -643,14 +675,14 @@ public void completeCollectionRecreateEvent(
boolean success, boolean success,
SharedSessionContractImplementor session) { SharedSessionContractImplementor session) {
if ( event != null ) { if ( event != null ) {
final CollectionRecreateEvent entityInsertEvent = (CollectionRecreateEvent) event; final CollectionRecreateEvent collectionRecreateEvent = (CollectionRecreateEvent) event;
entityInsertEvent.end(); collectionRecreateEvent.end();
if ( entityInsertEvent.shouldCommit() ) { if ( collectionRecreateEvent.shouldCommit() ) {
entityInsertEvent.sessionIdentifier = getSessionIdentifier( session ); collectionRecreateEvent.sessionIdentifier = getSessionIdentifier( session );
entityInsertEvent.role = role; collectionRecreateEvent.role = role;
entityInsertEvent.id = Objects.toString(id); collectionRecreateEvent.id = Objects.toString(id);
entityInsertEvent.success = success; collectionRecreateEvent.success = success;
entityInsertEvent.commit(); collectionRecreateEvent.commit();
} }
} }
} }
@ -674,14 +706,14 @@ public void completeCollectionUpdateEvent(
boolean success, boolean success,
SharedSessionContractImplementor session) { SharedSessionContractImplementor session) {
if ( event != null ) { if ( event != null ) {
final CollectionUpdateEvent entityUpdateEvent = (CollectionUpdateEvent) event; final CollectionUpdateEvent collectionUpdateEvent = (CollectionUpdateEvent) event;
entityUpdateEvent.end(); collectionUpdateEvent.end();
if ( entityUpdateEvent.shouldCommit() ) { if ( collectionUpdateEvent.shouldCommit() ) {
entityUpdateEvent.sessionIdentifier = getSessionIdentifier( session ); collectionUpdateEvent.sessionIdentifier = getSessionIdentifier( session );
entityUpdateEvent.role = role; collectionUpdateEvent.role = role;
entityUpdateEvent.id = Objects.toString(id); collectionUpdateEvent.id = Objects.toString(id);
entityUpdateEvent.success = success; collectionUpdateEvent.success = success;
entityUpdateEvent.commit(); collectionUpdateEvent.commit();
} }
} }
} }
@ -705,14 +737,14 @@ public void completeCollectionRemoveEvent(
boolean success, boolean success,
SharedSessionContractImplementor session) { SharedSessionContractImplementor session) {
if ( event != null ) { if ( event != null ) {
final CollectionRemoveEvent entityDeleteEvent = (CollectionRemoveEvent) event; final CollectionRemoveEvent collectionRemoveEvent = (CollectionRemoveEvent) event;
entityDeleteEvent.end(); collectionRemoveEvent.end();
if ( entityDeleteEvent.shouldCommit() ) { if ( collectionRemoveEvent.shouldCommit() ) {
entityDeleteEvent.sessionIdentifier = getSessionIdentifier( session ); collectionRemoveEvent.sessionIdentifier = getSessionIdentifier( session );
entityDeleteEvent.role = role; collectionRemoveEvent.role = role;
entityDeleteEvent.id = Objects.toString(id); collectionRemoveEvent.id = Objects.toString(id);
entityDeleteEvent.success = success; collectionRemoveEvent.success = success;
entityDeleteEvent.commit(); collectionRemoveEvent.commit();
} }
} }
} }