diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/ActionQueue.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/ActionQueue.java index 00a7786be4..726cd2d177 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/ActionQueue.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/ActionQueue.java @@ -1184,20 +1184,6 @@ public class ActionQueue { for ( int i = 0; i < latestBatches.size(); i++ ) { BatchIdentifier batchIdentifier = latestBatches.get( i ); - // Iterate previous batches and make sure that parent types are before children - // Since the outer loop looks at each batch entry individually, we need to verify that any - // prior batches in the list are not considered children (or have a parent) of the current - // batch. If so, we reordered them. - for ( int j = i - 1; j >= 0; j-- ) { - BatchIdentifier prevBatchIdentifier = latestBatches.get( j ); - if ( prevBatchIdentifier.hasParent( batchIdentifier ) && !batchIdentifier.hasParent( prevBatchIdentifier ) ) { - latestBatches.remove( batchIdentifier ); - latestBatches.add( j, batchIdentifier ); - - continue sort; - } - } - // Iterate next batches and make sure that children types are after parents. // Since the outer loop looks at each batch entry individually and the prior loop will reorder // entries as well, we need to look and verify if the current batch is a child of the next @@ -1219,7 +1205,7 @@ public class ActionQueue { if ( iterations > maxIterations ) { LOG.warn( "The batch containing " + latestBatches.size() + " statements could not be sorted after " + maxIterations + " iterations. " + - "This might indicate a bug in Hibernate!" ); + "This might indicate a circular entity relationship." ); } // Now, rebuild the insertions list. There is a batch for each entry in the name list.