HHH-7829 NullPointerException when manually flushing One-To-One
relationship with orphan removal
This commit is contained in:
parent
1dca45f06f
commit
17e8bbc6b7
|
@ -256,13 +256,17 @@ public final class Cascade {
|
||||||
final EntityEntry valueEntry = eventSource
|
final EntityEntry valueEntry = eventSource
|
||||||
.getPersistenceContext().getEntry(
|
.getPersistenceContext().getEntry(
|
||||||
loadedValue );
|
loadedValue );
|
||||||
final String entityName = valueEntry.getPersister().getEntityName();
|
// Need to check this in case the context has
|
||||||
if ( LOG.isTraceEnabled() ) {
|
// already been flushed. See HHH-7829.
|
||||||
final Serializable id = valueEntry.getPersister().getIdentifier( loadedValue, eventSource );
|
if ( valueEntry != null ) {
|
||||||
final String description = MessageHelper.infoString( entityName, id );
|
final String entityName = valueEntry.getPersister().getEntityName();
|
||||||
LOG.tracev( "Deleting orphaned entity instance: {0}", description );
|
if ( LOG.isTraceEnabled() ) {
|
||||||
|
final Serializable id = valueEntry.getPersister().getIdentifier( loadedValue, eventSource );
|
||||||
|
final String description = MessageHelper.infoString( entityName, id );
|
||||||
|
LOG.tracev( "Deleting orphaned entity instance: {0}", description );
|
||||||
|
}
|
||||||
|
eventSource.delete( entityName, loadedValue, false, new HashSet() );
|
||||||
}
|
}
|
||||||
eventSource.delete( entityName, loadedValue, false, new HashSet() );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue