mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-25 15:18:59 +00:00
Pr/add tests (#1103)
* ADD: Testcase for Sqlserver-6.2.0 driver * CHG: Removed Row-limit - so we need no special handling when sqlserver-platform generates a "select top 100" statement * ADD: additional asserts to TestQueryCache * CHG: Ignore test for sqlserver
This commit is contained in:
1 parent
96e3f4138f
commit
e908d16ba8
4 files changed
+112
-23
No files matched your search
@@ -0,0 +1,51 @@
|
||||
package org.tests.transaction;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.Transaction;
|
||||
|
||||
|
||||
import org.junit.Test;
|
||||
import org.tests.model.basic.ESimple;
|
||||
|
||||
/**
|
||||
* This test tests a strange bug in the 6.2.0. sqlserver JDBC driver.
|
||||
* (Version 6.1.7.jre8-preview works)
|
||||
*
|
||||
* https://github.com/Microsoft/mssql-jdbc/pull/374
|
||||
*
|
||||
* @author Roland Praml, FOCONIS AG
|
||||
*/
|
||||
public class TestSqlServerBatch extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void testAggressiveBatch() throws InterruptedException {
|
||||
|
||||
|
||||
Transaction txn = Ebean.beginTransaction();
|
||||
try {
|
||||
txn.setBatchMode(true);
|
||||
txn.setBatchSize(3);
|
||||
|
||||
// control flushing when mixing save and queries
|
||||
txn.setBatchFlushOnQuery(false);
|
||||
|
||||
// for large batch insert processing when we do not
|
||||
// ... need the generatedKeys, don't get them
|
||||
txn.setBatchGetGeneratedKeys(false);
|
||||
|
||||
// explicitly flush the JDBC batch buffer
|
||||
txn.flushBatch();
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
ESimple model = new ESimple();
|
||||
model.setName(i % 2 == 0 ? null:"foobar");
|
||||
Ebean.save(model);
|
||||
}
|
||||
|
||||
// do not commit
|
||||
} finally {
|
||||
txn.end();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user