HHH-12113 - The JDBC batch sorting algorithm can be simplified due to latest modifications

This commit is contained in:
Vlad Mihalcea 2017-11-21 17:40:45 +02:00
parent 7f70dccc71
commit 47382f69cc
1 changed files with 1 additions and 15 deletions

View File

@ -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.