Skip to content

Commit d4e1777

Browse files
committed
HHH-13815 TransientObjectException after merging a bidirectional one-to-many with orphan deletion
1 parent b8be111 commit d4e1777

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

hibernate-core/src/main/java/org/hibernate/collection/spi/AbstractPersistentCollection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,8 +1297,8 @@ protected static <E> Collection<E> getOrphans(
12971297
// iterate over the *old* list
12981298
for ( E old : oldElements ) {
12991299
if ( !currentSaving.contains( old ) ) {
1300-
final Object oldId = ForeignKeys.getEntityIdentifierIfNotUnsaved( entityName, old, session );
1301-
if ( !currentIds.contains( useIdDirect ? oldId : new TypedValue( idType, oldId ) ) ) {
1300+
final Object oldId = ForeignKeys.getEntityIdentifier( entityName, old, session );
1301+
if ( oldId != null && !currentIds.contains( useIdDirect ? oldId : new TypedValue( idType, oldId ) ) ) {
13021302
res.add( old );
13031303
}
13041304
}

0 commit comments

Comments
 (0)