mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-08 12:14:47 +00:00
HHH-7304 bugfix proposal
This commit is contained in:
parent
f58557a567
commit
a407665819
@ -72,7 +72,9 @@ protected AbstractEntityInsertAction(
|
||||
this.isExecuted = false;
|
||||
this.areTransientReferencesNullified = false;
|
||||
|
||||
handleNaturalIdPreSaveNotifications();
|
||||
if (id != null) {
|
||||
handleNaturalIdPreSaveNotifications();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -193,7 +195,17 @@ protected void handleNaturalIdPreSaveNotifications() {
|
||||
/**
|
||||
* 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
|
||||
getSession().getPersistenceContext().getNaturalIdHelper().manageSharedNaturalIdCrossReference(
|
||||
getPersister(),
|
||||
|
@ -123,7 +123,7 @@ public void execute() throws HibernateException {
|
||||
}
|
||||
}
|
||||
|
||||
handleNaturalIdPostSaveNotifications();
|
||||
handleNaturalIdPostSaveNotifications(id);
|
||||
|
||||
postInsert();
|
||||
|
||||
|
@ -298,6 +298,8 @@ protected Serializable performSaveOrReplicate(
|
||||
insert.getClass().getName() );
|
||||
}
|
||||
id = ( ( EntityIdentityInsertAction ) insert ).getGeneratedId();
|
||||
|
||||
insert.handleNaturalIdPostSaveNotifications(id);
|
||||
}
|
||||
|
||||
markInterceptorDirty( entity, persister, source );
|
||||
|
Loading…
x
Reference in New Issue
Block a user