mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-10-23 07:51:04 +00:00
#1552 - Remove deprecated methods on Transaction setBatch(PersistBatch) .. migrate to setBatchMode(boolean)
This commit is contained in:
@@ -358,29 +358,6 @@ public interface Transaction extends AutoCloseable {
|
||||
*/
|
||||
void setBatchMode(boolean useBatch);
|
||||
|
||||
/**
|
||||
* Deprecated - migrate to {@link #setBatchMode(boolean)}.
|
||||
* <p>
|
||||
* Set the JDBC batch mode to use for this transaction.
|
||||
* </p>
|
||||
* <p>
|
||||
* If this is NONE then JDBC batch can still be used for each request - save(), insert(), update() or delete()
|
||||
* and this would be useful if the request cascades to detail beans.
|
||||
* </p>
|
||||
*
|
||||
* @param persistBatchMode the batch mode to use for this transaction
|
||||
* @see io.ebean.config.ServerConfig#setPersistBatch(PersistBatch)
|
||||
*/
|
||||
@Deprecated
|
||||
void setBatch(PersistBatch persistBatchMode);
|
||||
|
||||
/**
|
||||
* Deprecated - migrate to {@link #isBatchMode()}.
|
||||
* Return the batch mode at the transaction level.
|
||||
*/
|
||||
@Deprecated
|
||||
PersistBatch getBatch();
|
||||
|
||||
/**
|
||||
* Return the batch mode at the transaction level.
|
||||
*/
|
||||
@@ -405,22 +382,6 @@ public interface Transaction extends AutoCloseable {
|
||||
*/
|
||||
void setBatchOnCascade(boolean batchMode);
|
||||
|
||||
/**
|
||||
* Set the batch mode when cascading.
|
||||
* <p>
|
||||
* Deprecated in favour of {@link #setBatchOnCascade(boolean)}
|
||||
* </p>
|
||||
*/
|
||||
@Deprecated
|
||||
void setBatchOnCascade(PersistBatch batchOnCascadeMode);
|
||||
|
||||
/**
|
||||
* Deprecated - migrate to {@link #isBatchMode()}.
|
||||
* Return the batch mode at the request level (for each save(), insert(), update() or delete()).
|
||||
*/
|
||||
@Deprecated
|
||||
PersistBatch getBatchOnCascade();
|
||||
|
||||
/**
|
||||
* Return the batch mode at the request level.
|
||||
*/
|
||||
|
||||
@@ -432,4 +432,11 @@ public final class TxScope {
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isBatchMode() {
|
||||
return PersistBatch.ALL.equals(batch);
|
||||
}
|
||||
|
||||
public boolean isBatchOnCascade() {
|
||||
return PersistBatch.ALL.equals(batchOnCascade);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package io.ebeaninternal.api;
|
||||
|
||||
import io.ebean.TxScope;
|
||||
import io.ebean.annotation.PersistBatch;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -38,9 +37,9 @@ public class ScopeTrans {
|
||||
*/
|
||||
private final ArrayList<Class<? extends Throwable>> rollbackFor;
|
||||
|
||||
private PersistBatch restoreBatch;
|
||||
private Boolean restoreBatch;
|
||||
|
||||
private PersistBatch restoreBatchOnCascade;
|
||||
private Boolean restoreBatchOnCascade;
|
||||
|
||||
private int restoreBatchSize;
|
||||
|
||||
@@ -68,20 +67,20 @@ public class ScopeTrans {
|
||||
|
||||
if (transaction != null) {
|
||||
if (!created && txScope.isBatchSet() || txScope.isBatchOnCascadeSet() || txScope.isBatchSizeSet()) {
|
||||
restoreBatch = transaction.getBatch();
|
||||
restoreBatchOnCascade = transaction.getBatchOnCascade();
|
||||
restoreBatch = transaction.isBatchMode();
|
||||
restoreBatchOnCascade = transaction.isBatchOnCascade();
|
||||
restoreBatchSize = transaction.getBatchSize();
|
||||
restoreBatchGeneratedKeys = transaction.getBatchGetGeneratedKeys();
|
||||
restoreBatchFlushOnQuery = transaction.isBatchFlushOnQuery();
|
||||
}
|
||||
if (txScope.isBatchSet()) {
|
||||
transaction.setBatch(txScope.getBatch());
|
||||
transaction.setBatchMode(txScope.isBatchMode());
|
||||
}
|
||||
if (!txScope.isFlushOnQuery()) {
|
||||
transaction.setBatchFlushOnQuery(false);
|
||||
}
|
||||
if (txScope.isBatchOnCascadeSet()) {
|
||||
transaction.setBatchOnCascade(txScope.getBatchOnCascade());
|
||||
transaction.setBatchOnCascade(txScope.isBatchOnCascade());
|
||||
}
|
||||
if (txScope.isBatchSizeSet()) {
|
||||
transaction.setBatchSize(txScope.getBatchSize());
|
||||
@@ -139,7 +138,7 @@ public class ScopeTrans {
|
||||
nestedCommit = true;
|
||||
transaction.setBatchFlushOnQuery(restoreBatchFlushOnQuery);
|
||||
if (restoreBatch != null) {
|
||||
transaction.setBatch(restoreBatch);
|
||||
transaction.setBatchMode(restoreBatch);
|
||||
}
|
||||
if (restoreBatchOnCascade != null) {
|
||||
transaction.setBatchOnCascade(restoreBatchOnCascade);
|
||||
|
||||
@@ -3,7 +3,6 @@ package io.ebeaninternal.api;
|
||||
import io.ebean.ProfileLocation;
|
||||
import io.ebean.TransactionCallback;
|
||||
import io.ebean.annotation.DocStoreMode;
|
||||
import io.ebean.annotation.PersistBatch;
|
||||
import io.ebean.bean.PersistenceContext;
|
||||
import io.ebean.event.changelog.BeanChange;
|
||||
import io.ebean.event.changelog.ChangeSet;
|
||||
@@ -254,36 +253,16 @@ public abstract class SpiTransactionProxy implements SpiTransaction {
|
||||
return transaction.isBatchMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBatch(PersistBatch persistBatchMode) {
|
||||
transaction.setBatch(persistBatchMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistBatch getBatch() {
|
||||
return transaction.getBatch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBatchOnCascade(boolean batchMode) {
|
||||
transaction.setBatchOnCascade(batchMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBatchOnCascade(PersistBatch batchOnCascadeMode) {
|
||||
transaction.setBatchOnCascade(batchOnCascadeMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBatchOnCascade() {
|
||||
return transaction.isBatchOnCascade();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistBatch getBatchOnCascade() {
|
||||
return transaction.getBatchOnCascade();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBatchSize(int batchSize) {
|
||||
transaction.setBatchSize(batchSize);
|
||||
|
||||
@@ -3,7 +3,6 @@ package io.ebeaninternal.server.transaction;
|
||||
import io.ebean.ProfileLocation;
|
||||
import io.ebean.TransactionCallback;
|
||||
import io.ebean.annotation.DocStoreMode;
|
||||
import io.ebean.annotation.PersistBatch;
|
||||
import io.ebean.bean.PersistenceContext;
|
||||
import io.ebean.event.changelog.BeanChange;
|
||||
import io.ebean.event.changelog.ChangeSet;
|
||||
@@ -291,11 +290,6 @@ class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEventCode
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBatch(PersistBatch batchMode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBatchMode() {
|
||||
return false;
|
||||
@@ -306,24 +300,10 @@ class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEventCode
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistBatch getBatch() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBatchOnCascade(boolean batchMode) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBatchOnCascade(PersistBatch batchOnCascadeMode) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistBatch getBatchOnCascade() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean getBatchGetGeneratedKeys() {
|
||||
return null;
|
||||
|
||||
@@ -3,7 +3,6 @@ package io.ebeaninternal.server.transaction;
|
||||
import io.ebean.ProfileLocation;
|
||||
import io.ebean.TransactionCallback;
|
||||
import io.ebean.annotation.DocStoreMode;
|
||||
import io.ebean.annotation.PersistBatch;
|
||||
import io.ebean.bean.PersistenceContext;
|
||||
import io.ebean.config.ServerConfig;
|
||||
import io.ebean.config.dbplatform.DatabasePlatform.OnQueryOnly;
|
||||
@@ -575,21 +574,11 @@ public class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
this.batchMode = batchMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBatch(PersistBatch batchMode) {
|
||||
setBatchMode(PersistBatch.ALL == batchMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBatchMode() {
|
||||
return batchMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistBatch getBatch() {
|
||||
return batchMode ? PersistBatch.ALL : PersistBatch.NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBatchOnCascade(boolean batchMode) {
|
||||
if (!isActive()) {
|
||||
@@ -598,16 +587,6 @@ public class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
this.batchOnCascadeMode = batchMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBatchOnCascade(PersistBatch batchMode) {
|
||||
setBatchOnCascade(PersistBatch.ALL == batchMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistBatch getBatchOnCascade() {
|
||||
return batchOnCascadeMode ? PersistBatch.ALL : PersistBatch.NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBatchOnCascade() {
|
||||
return batchOnCascadeMode;
|
||||
|
||||
@@ -3,7 +3,6 @@ package io.ebeaninternal.server.transaction;
|
||||
import io.ebean.ProfileLocation;
|
||||
import io.ebean.TransactionCallback;
|
||||
import io.ebean.annotation.DocStoreMode;
|
||||
import io.ebean.annotation.PersistBatch;
|
||||
import io.ebean.bean.PersistenceContext;
|
||||
import io.ebean.event.changelog.BeanChange;
|
||||
import io.ebean.event.changelog.ChangeSet;
|
||||
@@ -225,16 +224,6 @@ class NoTransaction implements SpiTransaction {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBatch(PersistBatch persistBatchMode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistBatch getBatch() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBatchMode() {
|
||||
return false;
|
||||
@@ -244,16 +233,6 @@ class NoTransaction implements SpiTransaction {
|
||||
public void setBatchOnCascade(boolean batchMode) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBatchOnCascade(PersistBatch batchOnCascadeMode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistBatch getBatchOnCascade() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBatchOnCascade() {
|
||||
return false;
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package io.ebean;
|
||||
|
||||
import io.ebean.annotation.PersistBatch;
|
||||
import org.tests.model.basic.EBasicVer;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
import org.tests.model.basic.EBasicVer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -61,7 +60,7 @@ public class EbeanServer_saveAllTest extends BaseTestCase {
|
||||
|
||||
Transaction transaction = server.beginTransaction();
|
||||
try {
|
||||
transaction.setBatch(PersistBatch.ALL);
|
||||
transaction.setBatchMode(true);
|
||||
LoggedSqlCollector.start();
|
||||
|
||||
for (EBasicVer bean : beans(2)) {
|
||||
|
||||
@@ -37,7 +37,7 @@ public class TestBatchInsertFlush extends BaseTestCase {
|
||||
try {
|
||||
transaction.setPersistCascade(false);
|
||||
transaction.setBatchSize(10);
|
||||
transaction.setBatch(PersistBatch.ALL);
|
||||
transaction.setBatchMode(true);
|
||||
transaction.setLabel("TestBatchInsertFlush.no_cascade");
|
||||
|
||||
LoggedSqlCollector.start();
|
||||
@@ -126,7 +126,7 @@ public class TestBatchInsertFlush extends BaseTestCase {
|
||||
|
||||
EbeanServer server = Ebean.getDefaultServer();
|
||||
LoggedSqlCollector.start();
|
||||
|
||||
|
||||
EBasicVer b1 = new EBasicVer("b1");
|
||||
server.save(b1);
|
||||
|
||||
@@ -138,7 +138,7 @@ public class TestBatchInsertFlush extends BaseTestCase {
|
||||
Integer id = b1.getId();
|
||||
assertNotNull(id);
|
||||
assertThat(LoggedSqlCollector.current()).hasSize(2);
|
||||
|
||||
|
||||
EBasicVer b3 = new EBasicVer("b3");
|
||||
server.save(b3);
|
||||
}
|
||||
@@ -174,13 +174,13 @@ public class TestBatchInsertFlush extends BaseTestCase {
|
||||
txn.end();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Transactional(batch = PersistBatch.ALL)
|
||||
public void transactional_noflushWhenIdIsLoaded() {
|
||||
|
||||
EbeanServer server = Ebean.getDefaultServer();
|
||||
|
||||
|
||||
LoggedSqlCollector.start();
|
||||
|
||||
EBasicVer b1 = new EBasicVer("b1");
|
||||
@@ -196,10 +196,10 @@ public class TestBatchInsertFlush extends BaseTestCase {
|
||||
Integer id = b1.getId();
|
||||
assertNotNull(id);
|
||||
assertThat(LoggedSqlCollector.current()).isEmpty();
|
||||
|
||||
|
||||
EBasicVer b3 = new EBasicVer("b3");
|
||||
server.save(b3);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -242,7 +242,7 @@ public class TestBatchInsertFlush extends BaseTestCase {
|
||||
EbeanServer server = Ebean.getDefaultServer();
|
||||
Transaction txn = server.beginTransaction();
|
||||
try {
|
||||
txn.setBatch(PersistBatch.ALL);
|
||||
txn.setBatchMode(true);
|
||||
|
||||
EBasicVer b1 = new EBasicVer("b1");
|
||||
server.save(b1, txn);
|
||||
@@ -270,7 +270,7 @@ public class TestBatchInsertFlush extends BaseTestCase {
|
||||
EbeanServer server = Ebean.getDefaultServer();
|
||||
Transaction txn = server.beginTransaction();
|
||||
try {
|
||||
txn.setBatch(PersistBatch.ALL);
|
||||
txn.setBatchMode(true);
|
||||
|
||||
EBasicVer b1 = new EBasicVer("b1");
|
||||
server.save(b1, txn);
|
||||
|
||||
@@ -29,8 +29,8 @@ public class TestBatchInsertSimple extends BaseTestCase {
|
||||
|
||||
Transaction transaction = Ebean.beginTransaction();
|
||||
try {
|
||||
transaction.setBatch(PersistBatch.NONE);
|
||||
transaction.setBatchOnCascade(PersistBatch.ALL);
|
||||
transaction.setBatchMode(false);
|
||||
transaction.setBatchOnCascade(true);
|
||||
transaction.setBatchSize(30);
|
||||
// setBatchGetGeneratedKeys MUST be turned off for MS SQL Server because :(
|
||||
transaction.setBatchGetGeneratedKeys(false);
|
||||
@@ -103,8 +103,8 @@ public class TestBatchInsertSimple extends BaseTestCase {
|
||||
|
||||
Transaction transaction = Ebean.beginTransaction();
|
||||
try {
|
||||
transaction.setBatch(PersistBatch.NONE);
|
||||
transaction.setBatchOnCascade(PersistBatch.ALL);
|
||||
transaction.setBatchMode(false);
|
||||
transaction.setBatchOnCascade(true);
|
||||
transaction.setBatchSize(30);
|
||||
// setBatchGetGeneratedKeys MUST be turned off for MS SQL Server because :(
|
||||
transaction.setBatchGetGeneratedKeys(false);
|
||||
@@ -133,8 +133,8 @@ public class TestBatchInsertSimple extends BaseTestCase {
|
||||
|
||||
Transaction transaction = Ebean.beginTransaction();
|
||||
try {
|
||||
transaction.setBatch(PersistBatch.NONE);
|
||||
transaction.setBatchOnCascade(spiEbeanServer().getDatabasePlatform().getPersistBatchOnCascade());
|
||||
transaction.setBatchMode(true);
|
||||
transaction.setBatchOnCascade(PersistBatch.ALL.equals(spiEbeanServer().getDatabasePlatform().getPersistBatchOnCascade()));
|
||||
transaction.setBatchSize(20);
|
||||
|
||||
// escalate based on batchOnCascade value
|
||||
|
||||
@@ -3,10 +3,9 @@ package org.tests.batchinsert;
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.annotation.PersistBatch;
|
||||
import org.tests.model.basic.OCachedBean;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
import org.tests.model.basic.OCachedBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -31,7 +30,7 @@ public class TestBatchInsertWithInitialisedCollection extends BaseTestCase {
|
||||
|
||||
Transaction txn = Ebean.beginTransaction();
|
||||
try {
|
||||
txn.setBatch(PersistBatch.ALL);
|
||||
txn.setBatchMode(true);
|
||||
|
||||
Ebean.saveAll(list);
|
||||
txn.commit();
|
||||
|
||||
@@ -8,11 +8,11 @@ import io.ebean.annotation.PersistBatch;
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebeaninternal.api.SpiTransaction;
|
||||
import io.ebeaninternal.server.persist.BatchControl;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.Test;
|
||||
import org.tests.model.basic.EBasicWithUniqueCon;
|
||||
import org.tests.model.basic.EOptOneB;
|
||||
import org.tests.model.basic.EOptOneC;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.Test;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.sql.SQLException;
|
||||
@@ -86,13 +86,13 @@ public class TestBatchOnCascadeExceptionHandling extends BaseTestCase {
|
||||
protected void testBatchOnCascadeIsExceptionSafe(EbeanServer server, Runnable failingOperation) {
|
||||
Transaction txn = server.beginTransaction();
|
||||
try {
|
||||
assertThat(txn.getBatch()).isSameAs(PersistBatch.NONE);
|
||||
assertThat(txn.getBatchOnCascade()).isSameAs(spiEbeanServer().getDatabasePlatform().getPersistBatchOnCascade());
|
||||
assertThat(txn.isBatchMode()).isFalse();
|
||||
assertThat(txn.isBatchOnCascade()).isSameAs(PersistBatch.ALL.equals(spiEbeanServer().getDatabasePlatform().getPersistBatchOnCascade()));
|
||||
|
||||
failingOperation.run();
|
||||
Assertions.fail("PersistenceException expected");
|
||||
} catch (PersistenceException e) {
|
||||
assertThat(txn.getBatch()).as("batch mode").isSameAs(PersistBatch.NONE); // should not have changed
|
||||
assertThat(txn.isBatchMode()).as("batch mode").isFalse(); // should not have changed
|
||||
BatchControl bc = ((SpiTransaction) txn).getBatchControl();
|
||||
assertThat(bc == null || bc.isEmpty()).as("batch emtpy").isTrue();
|
||||
} finally {
|
||||
|
||||
@@ -4,11 +4,10 @@ import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.EbeanServer;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.annotation.PersistBatch;
|
||||
import org.junit.Test;
|
||||
import org.tests.model.basic.Contact;
|
||||
import org.tests.model.basic.EBasicVer;
|
||||
import org.tests.model.converstation.Group;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.assertj.core.api.StrictAssertions.assertThat;
|
||||
|
||||
@@ -48,7 +47,7 @@ public class TestDeleteWithoutOptimisticLocking extends BaseTestCase {
|
||||
EbeanServer server = Ebean.getDefaultServer();
|
||||
Transaction transaction = server.beginTransaction();
|
||||
try {
|
||||
transaction.setBatch(PersistBatch.ALL);
|
||||
transaction.setBatchMode(true);
|
||||
|
||||
// returns true even though the delete has not occurred yet
|
||||
assertThat(server.delete(Ebean.getReference(EBasicVer.class, basic.getId()), transaction)).isTrue();
|
||||
|
||||
@@ -4,9 +4,7 @@ import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.annotation.IgnorePlatform;
|
||||
import io.ebean.annotation.PersistBatch;
|
||||
import io.ebean.annotation.Platform;
|
||||
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -25,7 +23,7 @@ public class TestInsertBatchThenFlushThenUpdate extends BaseTestCase {
|
||||
LoggedSqlCollector.start();
|
||||
Transaction txn = Ebean.beginTransaction();
|
||||
try {
|
||||
txn.setBatch(PersistBatch.ALL);
|
||||
txn.setBatchMode(true);
|
||||
|
||||
EdParent parent = new EdParent();
|
||||
parent.setName("MyComputer");
|
||||
|
||||
@@ -4,9 +4,7 @@ import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.annotation.IgnorePlatform;
|
||||
import io.ebean.annotation.PersistBatch;
|
||||
import io.ebean.annotation.Platform;
|
||||
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -25,7 +23,7 @@ public class TestInsertBatchThenUpdate extends BaseTestCase {
|
||||
LoggedSqlCollector.start();
|
||||
Transaction txn = Ebean.beginTransaction();
|
||||
try {
|
||||
txn.setBatch(PersistBatch.ALL);
|
||||
txn.setBatchMode(true);
|
||||
|
||||
LoggedSqlCollector.start();
|
||||
|
||||
@@ -70,7 +68,7 @@ public class TestInsertBatchThenUpdate extends BaseTestCase {
|
||||
LoggedSqlCollector.start();
|
||||
Transaction txn = Ebean.beginTransaction();
|
||||
try {
|
||||
txn.setBatch(PersistBatch.ALL);
|
||||
txn.setBatchMode(true);
|
||||
|
||||
LoggedSqlCollector.start();
|
||||
|
||||
|
||||
@@ -4,9 +4,7 @@ import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.annotation.IgnorePlatform;
|
||||
import io.ebean.annotation.PersistBatch;
|
||||
import io.ebean.annotation.Platform;
|
||||
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -24,7 +22,7 @@ public class TestInsertBatchWithDifferentRootTypes extends BaseTestCase {
|
||||
LoggedSqlCollector.start();
|
||||
Transaction txn = Ebean.beginTransaction();
|
||||
try {
|
||||
txn.setBatch(PersistBatch.ALL);
|
||||
txn.setBatchMode(true);
|
||||
|
||||
EdParent parent = new EdParent();
|
||||
parent.setName("MyComputer");
|
||||
|
||||
@@ -4,11 +4,10 @@ import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.Query;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.annotation.PersistBatch;
|
||||
import org.junit.Test;
|
||||
import org.tests.model.softdelete.ESoftDelMid;
|
||||
import org.tests.model.softdelete.ESoftDelTop;
|
||||
import org.tests.model.softdelete.ESoftDelUp;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -38,7 +37,7 @@ public class TestSoftDeleteTop extends BaseTestCase {
|
||||
|
||||
Transaction transaction = Ebean.beginTransaction();
|
||||
try {
|
||||
transaction.setBatch(PersistBatch.ALL);
|
||||
transaction.setBatchMode(true);
|
||||
Ebean.delete(up1);
|
||||
Ebean.delete(up2);
|
||||
transaction.commit();
|
||||
|
||||
@@ -5,15 +5,13 @@ import io.ebean.Ebean;
|
||||
import io.ebean.EbeanServer;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.annotation.IgnorePlatform;
|
||||
import io.ebean.annotation.PersistBatch;
|
||||
import io.ebean.annotation.Platform;
|
||||
|
||||
import org.tests.model.basic.UTDetail;
|
||||
import org.tests.model.basic.UTMaster;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.tests.model.basic.UTDetail;
|
||||
import org.tests.model.basic.UTMaster;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -33,7 +31,7 @@ public class TestBatchPersistCascade extends BaseTestCase {
|
||||
|
||||
Transaction txn = ebeanServer.beginTransaction();
|
||||
try {
|
||||
txn.setBatch(PersistBatch.ALL);
|
||||
txn.setBatchMode(true);
|
||||
logger.info("start ------------");
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
@@ -66,8 +64,8 @@ public class TestBatchPersistCascade extends BaseTestCase {
|
||||
|
||||
Transaction txn = server.beginTransaction();
|
||||
try {
|
||||
txn.setBatch(PersistBatch.ALL);
|
||||
txn.setBatchOnCascade(PersistBatch.ALL);
|
||||
txn.setBatchMode(true);
|
||||
txn.setBatchOnCascade(true);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
UTMaster master = createMaster(i + 500);
|
||||
|
||||
Reference in New Issue
Block a user