HHH-7304 bugfix proposal
This commit is contained in:
parent
f58557a567
commit
a407665819
|
@ -72,7 +72,9 @@ public abstract class AbstractEntityInsertAction extends EntityAction {
|
||||||
this.isExecuted = false;
|
this.isExecuted = false;
|
||||||
this.areTransientReferencesNullified = false;
|
this.areTransientReferencesNullified = false;
|
||||||
|
|
||||||
handleNaturalIdPreSaveNotifications();
|
if (id != null) {
|
||||||
|
handleNaturalIdPreSaveNotifications();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -193,7 +195,17 @@ public abstract class AbstractEntityInsertAction extends EntityAction {
|
||||||
/**
|
/**
|
||||||
* Handle sending notifications needed for natural-id after saving
|
* Handle sending notifications needed for natural-id after saving
|
||||||
*/
|
*/
|
||||||
protected void handleNaturalIdPostSaveNotifications() {
|
public void handleNaturalIdPostSaveNotifications(Serializable id) {
|
||||||
|
if (isEarlyInsert()) {
|
||||||
|
// with early insert, we still need to add a local (transactional) natural id cross-reference
|
||||||
|
getSession().getPersistenceContext().getNaturalIdHelper().manageLocalNaturalIdCrossReference(
|
||||||
|
getPersister(),
|
||||||
|
id,
|
||||||
|
state,
|
||||||
|
null,
|
||||||
|
CachedNaturalIdValueSource.INSERT
|
||||||
|
);
|
||||||
|
}
|
||||||
// after save, we need to manage the shared cache entries
|
// after save, we need to manage the shared cache entries
|
||||||
getSession().getPersistenceContext().getNaturalIdHelper().manageSharedNaturalIdCrossReference(
|
getSession().getPersistenceContext().getNaturalIdHelper().manageSharedNaturalIdCrossReference(
|
||||||
getPersister(),
|
getPersister(),
|
||||||
|
|
|
@ -123,7 +123,7 @@ public final class EntityInsertAction extends AbstractEntityInsertAction {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleNaturalIdPostSaveNotifications();
|
handleNaturalIdPostSaveNotifications(id);
|
||||||
|
|
||||||
postInsert();
|
postInsert();
|
||||||
|
|
||||||
|
|
|
@ -298,6 +298,8 @@ public abstract class AbstractSaveEventListener extends AbstractReassociateEvent
|
||||||
insert.getClass().getName() );
|
insert.getClass().getName() );
|
||||||
}
|
}
|
||||||
id = ( ( EntityIdentityInsertAction ) insert ).getGeneratedId();
|
id = ( ( EntityIdentityInsertAction ) insert ).getGeneratedId();
|
||||||
|
|
||||||
|
insert.handleNaturalIdPostSaveNotifications(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
markInterceptorDirty( entity, persister, source );
|
markInterceptorDirty( entity, persister, source );
|
||||||
|
|
Loading…
Reference in New Issue