mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#993 - ENH: Add flush() to EbeanServer and Model to make it more accessible than the current transaction.flushBatch()
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user