mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-12 22:41:35 +00:00
1 parent
cc637d56e1
commit
8e91268979
4 files changed
+14
-16
No files matched your search
@@ -6,6 +6,7 @@ import io.ebean.SqlUpdate;
|
||||
import io.ebean.Transaction;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
@@ -27,9 +28,8 @@ public class TestSqlUpdateBatch extends BaseTestCase {
|
||||
// Dummy updates, that effectively do nothing, but ebean doesn't need to know this.
|
||||
final SqlUpdate update = DB.sqlUpdate("update uuone set name = ? where 0=1");
|
||||
final SqlUpdate delete = DB.sqlUpdate("delete from uuone where ?=-1");
|
||||
// txn.setBatchSize(40);
|
||||
|
||||
for (int i = 0; i <= 20; i++) {
|
||||
for (int i = 0; i < 20; i++) {
|
||||
update
|
||||
.setParameter(1, String.valueOf(i))
|
||||
.addBatch();
|
||||
@@ -38,8 +38,8 @@ public class TestSqlUpdateBatch extends BaseTestCase {
|
||||
.addBatch();
|
||||
}
|
||||
|
||||
delete.executeBatch();
|
||||
update.executeBatch();
|
||||
assertThat(delete.executeBatch().length).isEqualTo(20);
|
||||
assertThat(update.executeBatch().length).isEqualTo(20);
|
||||
txn.commit();
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,8 @@ public class TestSqlUpdateBatch extends BaseTestCase {
|
||||
@Test
|
||||
public void testBatchReturnArrayLength() {
|
||||
try (Transaction txn = DB.beginTransaction()) {
|
||||
txn.setBatchSize(100); // something bigger than 40
|
||||
// transaction batch size is ignored with addBatch()
|
||||
txn.setBatchSize(10);
|
||||
// Dummy update, that effectively does nothing, but ebean doesn't need to know this.
|
||||
final SqlUpdate update = DB.sqlUpdate("update uuone set name = ? where 0=1");
|
||||
for (int i = 0; i < 40; i++) {
|
||||
|
||||
Reference in new issue
Block a user