#993 - ENH: Add flush() to EbeanServer and Model to make it more accessible than the current transaction.flushBatch()

This commit is contained in:
Rob Bygrave
2017-03-13 23:07:17 +13:00
parent 1d99a5c5a4
commit 4d82b86f81
8 changed files with 81 additions and 2 deletions
@@ -460,6 +460,11 @@ public class TDSpiEbeanServer implements SpiEbeanServer {
return null;
}
@Override
public void flush() {
}
@Override
public void commitTransaction() {
@@ -0,0 +1,27 @@
package org.tests.transaction;
import io.ebean.BaseTestCase;
import io.ebean.annotation.Transactional;
import org.junit.Test;
import org.tests.model.m2m.MnyB;
public class TestBatchModelFlush extends BaseTestCase {
@Transactional(batchSize = 50)
@Test
public void insert() {
new MnyB("TestBatchModelFlush_0").save();
new MnyB("TestBatchModelFlush_1").save();
MnyB bean = new MnyB("TestBatchModelFlush_2");
bean.save();
bean.db().currentTransaction().flush();
MnyB bean2 = new MnyB("TestBatchModelFlush_3");
bean2.save();
bean2.db().flush();
new MnyB("TestBatchModelFlush_4").save();
}
}