mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#2138 - Mark Transaction.flushBatch() as deprecated - migrate to flush();
This commit is contained in:
@@ -519,11 +519,11 @@ public interface Transaction extends AutoCloseable {
|
||||
void flush() throws PersistenceException;
|
||||
|
||||
/**
|
||||
* This is a synonym for flush() and will be deprecated.
|
||||
* Deprecated - migrate to flush().
|
||||
* <p>
|
||||
* flush() is preferred as it matches the JPA flush() method.
|
||||
* </p>
|
||||
*/
|
||||
@Deprecated
|
||||
void flushBatch() throws PersistenceException;
|
||||
|
||||
/**
|
||||
|
||||
@@ -388,7 +388,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
@Override
|
||||
public void preGetterTrigger(int propertyIndex) {
|
||||
if (flushBatchOnGetter(propertyIndex)) {
|
||||
transaction.flushBatch();
|
||||
transaction.flush();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -56,7 +56,7 @@ class MergeNodeAssocManyToMany extends MergeNode {
|
||||
IntersectionTable intersectionTable = many.intersectionTable();
|
||||
|
||||
if (!deletions.isEmpty()) {
|
||||
transaction.flushBatch();
|
||||
transaction.flush();
|
||||
|
||||
SqlUpdate delete = intersectionTable.delete(server, false);
|
||||
for (EntityBean deletion : deletions) {
|
||||
@@ -67,7 +67,7 @@ class MergeNodeAssocManyToMany extends MergeNode {
|
||||
}
|
||||
|
||||
if (!additions.isEmpty()) {
|
||||
transaction.flushBatch();
|
||||
transaction.flush();
|
||||
|
||||
SqlUpdate insert = intersectionTable.insert(server, false);
|
||||
for (EntityBean addition : additions) {
|
||||
|
||||
@@ -58,7 +58,7 @@ public class DefaultOrmQueryEngine implements OrmQueryEngine {
|
||||
// before we perform a query, we need to flush any
|
||||
// previous persist requests that are queued/batched.
|
||||
// The query may read data affected by those requests.
|
||||
t.flushBatch();
|
||||
t.flush();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public class TestInsertDuplicateKey extends BaseTestCase {
|
||||
public void clearDb() {
|
||||
server().find(Document.class).asDraft().where().contains("title", "UniqueKey").delete();
|
||||
}
|
||||
|
||||
|
||||
@Test(expected = DuplicateKeyException.class)
|
||||
public void insert_duplicateKey() {
|
||||
|
||||
@@ -89,7 +89,7 @@ public class TestInsertDuplicateKey extends BaseTestCase {
|
||||
doc2.save();
|
||||
|
||||
// flush at this point, fails
|
||||
Ebean.getDefaultServer().currentTransaction().flushBatch();
|
||||
Ebean.getDefaultServer().currentTransaction().flush();
|
||||
} catch (DuplicateKeyException e) {
|
||||
log.info("duplicate failed but just continue" + e.getMessage());
|
||||
try {
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ public class TestInsertBatchThenFlushThenUpdate extends BaseTestCase {
|
||||
// nothing flushed yet
|
||||
assertThat(LoggedSqlCollector.start()).isEmpty();
|
||||
|
||||
txn.flushBatch();
|
||||
txn.flush();
|
||||
|
||||
List<String> loggedSql1 = LoggedSqlCollector.start();
|
||||
assertThat(loggedSql1).hasSize(4);
|
||||
|
||||
@@ -11,7 +11,7 @@ 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)
|
||||
*
|
||||
* <p>
|
||||
* https://github.com/Microsoft/mssql-jdbc/pull/374
|
||||
*
|
||||
* @author Roland Praml, FOCONIS AG
|
||||
@@ -29,7 +29,7 @@ public class TestSqlServerBatch extends BaseTestCase {
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
ESimple model = new ESimple();
|
||||
model.setName("baz "+i);
|
||||
model.setName("baz " + i);
|
||||
Ebean.save(model);
|
||||
}
|
||||
|
||||
@@ -56,13 +56,13 @@ public class TestSqlServerBatch extends BaseTestCase {
|
||||
txn.setGetGeneratedKeys(false);
|
||||
|
||||
// explicitly flush the JDBC batch buffer
|
||||
txn.flushBatch();
|
||||
txn.flush();
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
ESimple model = new ESimple();
|
||||
model.setName(i % 2 == 0 ? null:"foobar");
|
||||
Ebean.save(model);
|
||||
}
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user