From da0b46d61c810533e7a642026ab12cdb2fedc0ba Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Tue, 19 Apr 2016 21:02:22 +0100 Subject: [PATCH] HHH-10375 - Fix adding an entity at index to list with @OrderColumn in detached Entity --- .../collection/internal/PersistentList.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/collection/internal/PersistentList.java b/hibernate-core/src/main/java/org/hibernate/collection/internal/PersistentList.java index 6d5e99f619..a1825b598f 100644 --- a/hibernate-core/src/main/java/org/hibernate/collection/internal/PersistentList.java +++ b/hibernate-core/src/main/java/org/hibernate/collection/internal/PersistentList.java @@ -314,18 +314,8 @@ public class PersistentList extends AbstractPersistentCollection implements List if ( index < 0 ) { throw new ArrayIndexOutOfBoundsException( "negative index" ); } - if ( !isInitialized() || isConnectedToSession() ) { - // NOTE : we don't care about the inverse part here because - // even if the collection is inverse, this side is driving the - // writing of the indexes. And because this is a positioned-add - // we need to load the underlying elements to know how that - // affects overall re-ordering - write(); - list.add( index, value ); - } - else { - queueOperation( new Add( index, value ) ); - } + write(); + list.add( index, value ); } @Override