HHH-12419 - Incorrect batch inserts example
This commit is contained in:
parent
cb3d3c0fd7
commit
2903551b19
|
@ -200,15 +200,15 @@ public class BatchTest extends BaseEntityManagerFunctionalTestCase {
|
||||||
|
|
||||||
int batchSize = 25;
|
int batchSize = 25;
|
||||||
|
|
||||||
for ( int i = 0; i < entityCount; ++i ) {
|
for ( int i = 0; i < entityCount; i++ ) {
|
||||||
Person Person = new Person( String.format( "Person %d", i ) );
|
|
||||||
entityManager.persist( Person );
|
|
||||||
|
|
||||||
if ( i > 0 && i % batchSize == 0 ) {
|
if ( i > 0 && i % batchSize == 0 ) {
|
||||||
//flush a batch of inserts and release memory
|
//flush a batch of inserts and release memory
|
||||||
entityManager.flush();
|
entityManager.flush();
|
||||||
entityManager.clear();
|
entityManager.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Person Person = new Person( String.format( "Person %d", i ) );
|
||||||
|
entityManager.persist( Person );
|
||||||
}
|
}
|
||||||
|
|
||||||
txn.commit();
|
txn.commit();
|
||||||
|
|
Loading…
Reference in New Issue