mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#798 - Add @Transactional based test
This commit is contained in:
@@ -4,6 +4,7 @@ import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.EbeanServer;
|
||||
import com.avaje.ebean.Transaction;
|
||||
import com.avaje.ebean.annotation.Transactional;
|
||||
import com.avaje.ebean.config.PersistBatch;
|
||||
import com.avaje.tests.model.basic.EBasicVer;
|
||||
import org.junit.Test;
|
||||
@@ -14,6 +15,24 @@ import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class TestBatchInsertFlush extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
@Transactional(batch = PersistBatch.ALL)
|
||||
public void transactional_flushOnGetId() {
|
||||
|
||||
EbeanServer server = Ebean.getDefaultServer();
|
||||
|
||||
EBasicVer b1 = new EBasicVer("b1");
|
||||
server.save(b1);
|
||||
|
||||
EBasicVer b2 = new EBasicVer("b2");
|
||||
server.save(b2);
|
||||
|
||||
Integer id = b1.getId();
|
||||
assertNotNull(id);
|
||||
EBasicVer b3 = new EBasicVer("b3");
|
||||
server.save(b3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFlushOnGetId() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user