HHH-14876 Fix BatchLoadSizingStrategy#determineOptimalBatchLoadSize()
This commit is contained in:
parent
f9d0b7d069
commit
53ad8d36e2
|
@ -3074,13 +3074,17 @@ public abstract class Dialect implements ConversionContext {
|
||||||
if ( numberOfKeyColumns > 1 ) {
|
if ( numberOfKeyColumns > 1 ) {
|
||||||
return paddedSize;
|
return paddedSize;
|
||||||
}
|
}
|
||||||
if ( paddedSize < getInExpressionCountLimit() ) {
|
final int inExpressionCountLimit = getInExpressionCountLimit();
|
||||||
return paddedSize;
|
if ( inExpressionCountLimit > 0 ) {
|
||||||
|
if ( paddedSize < inExpressionCountLimit ) {
|
||||||
|
return paddedSize;
|
||||||
|
}
|
||||||
|
else if ( numberOfKeys < inExpressionCountLimit ) {
|
||||||
|
return numberOfKeys;
|
||||||
|
}
|
||||||
|
return getInExpressionCountLimit();
|
||||||
}
|
}
|
||||||
else if ( numberOfKeys < getInExpressionCountLimit() ) {
|
return paddedSize;
|
||||||
return numberOfKeys;
|
|
||||||
}
|
|
||||||
return getInExpressionCountLimit();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -88,25 +88,11 @@ public class MultiLoadSubSelectCollectionTest {
|
||||||
assertFalse( Hibernate.isInitialized( p.children ) );
|
assertFalse( Hibernate.isInitialized( p.children ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// When the first collection is loaded, the full batch of 50 collections
|
// When the first collection is loaded, the full collection
|
||||||
// should be loaded.
|
// should be loaded.
|
||||||
Hibernate.initialize( list.get( 0 ).children );
|
Hibernate.initialize( list.get( 0 ).children );
|
||||||
|
|
||||||
for ( int i = 0; i < 50; i++ ) {
|
for ( int i = 0; i < 56; i++ ) {
|
||||||
assertTrue( Hibernate.isInitialized( list.get( i ).children ) );
|
|
||||||
assertEquals( i + 1, list.get( i ).children.size() );
|
|
||||||
}
|
|
||||||
|
|
||||||
// The collections for the 51st through 56th entities should still be uninitialized
|
|
||||||
for ( int i = 50; i < 56; i++ ) {
|
|
||||||
assertFalse( Hibernate.isInitialized( list.get( i ).children ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
// When the 51st collection gets initialized, the remaining collections should
|
|
||||||
// also be initialized.
|
|
||||||
Hibernate.initialize( list.get( 50 ).children );
|
|
||||||
|
|
||||||
for ( int i = 50; i < 56; i++ ) {
|
|
||||||
assertTrue( Hibernate.isInitialized( list.get( i ).children ) );
|
assertTrue( Hibernate.isInitialized( list.get( i ).children ) );
|
||||||
assertEquals( i + 1, list.get( i ).children.size() );
|
assertEquals( i + 1, list.get( i ).children.size() );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue