mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Remove autoCommitMode and explicitTransactionBeginMode (#1993)
These are legacy options that we don't want anyone using going forward.
This commit is contained in:
@@ -331,18 +331,6 @@ public class ServerConfig {
|
||||
*/
|
||||
private ClassLoadConfig classLoadConfig = new ClassLoadConfig();
|
||||
|
||||
/**
|
||||
* Set to true if the DataSource uses autoCommit.
|
||||
* <p>
|
||||
* Indicates that Ebean should use autoCommit friendly Transactions and TransactionManager.
|
||||
*/
|
||||
private boolean autoCommitMode;
|
||||
|
||||
/**
|
||||
* Set to true if transaction begin should be started with explicit statement.
|
||||
*/
|
||||
private boolean explicitTransactionBeginMode;
|
||||
|
||||
/**
|
||||
* The data source JNDI name if using a JNDI DataSource.
|
||||
*/
|
||||
@@ -1745,42 +1733,6 @@ public class ServerConfig {
|
||||
this.dataSourceJndiName = dataSourceJndiName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if autoCommit mode is on. This indicates to Ebean to use autoCommit friendly Transactions and TransactionManager.
|
||||
*/
|
||||
public boolean isAutoCommitMode() {
|
||||
return autoCommitMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set to true if autoCommit mode is on and Ebean should use autoCommit friendly Transactions and TransactionManager.
|
||||
*/
|
||||
public void setAutoCommitMode(boolean autoCommitMode) {
|
||||
this.autoCommitMode = autoCommitMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if transaction begin should be started with explicit statement.
|
||||
*/
|
||||
public boolean isExplicitTransactionBeginMode() {
|
||||
return explicitTransactionBeginMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set to true if transaction begin should be started with explicit statement.
|
||||
* <p>
|
||||
* This works for H2 and Postgres but not for Oracle - only use this if you first name
|
||||
* is Daryl or you have explicitly talked to Rob about this feature.
|
||||
* </p>
|
||||
* <p>
|
||||
* This is generally not expected to be turned on but instead allow transactions to start
|
||||
* implicitly which is generally the standard approach.
|
||||
* </p>
|
||||
*/
|
||||
public void setExplicitTransactionBeginMode(boolean explicitTransactionBeginMode) {
|
||||
this.explicitTransactionBeginMode = explicitTransactionBeginMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a value used to represent TRUE in the database.
|
||||
* <p>
|
||||
@@ -2868,8 +2820,6 @@ public class ServerConfig {
|
||||
localOnlyL2Cache = p.getBoolean("localOnlyL2Cache", localOnlyL2Cache);
|
||||
enabledL2Regions = p.get("enabledL2Regions", enabledL2Regions);
|
||||
notifyL2CacheInForeground = p.getBoolean("notifyL2CacheInForeground", notifyL2CacheInForeground);
|
||||
explicitTransactionBeginMode = p.getBoolean("explicitTransactionBeginMode", explicitTransactionBeginMode);
|
||||
autoCommitMode = p.getBoolean("autoCommitMode", autoCommitMode);
|
||||
useJtaTransactionManager = p.getBoolean("useJtaTransactionManager", useJtaTransactionManager);
|
||||
useJavaxValidationNotNull = p.getBoolean("useJavaxValidationNotNull", useJavaxValidationNotNull);
|
||||
autoReadOnlyDataSource = p.getBoolean("autoReadOnlyDataSource", autoReadOnlyDataSource);
|
||||
|
||||
@@ -256,7 +256,7 @@ public class DefaultContainer implements SpiContainer {
|
||||
}
|
||||
|
||||
try (Connection connection = serverConfig.getDataSource().getConnection()) {
|
||||
if (!serverConfig.isAutoCommitMode() && connection.getAutoCommit()) {
|
||||
if (connection.getAutoCommit()) {
|
||||
logger.warn("DataSource [{}] has autoCommit defaulting to true!", serverConfig.getName());
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -15,7 +15,6 @@ import io.ebean.config.ServerConfig;
|
||||
import io.ebean.config.SlowQueryListener;
|
||||
import io.ebean.config.dbplatform.DatabasePlatform;
|
||||
import io.ebean.config.dbplatform.DbHistorySupport;
|
||||
import io.ebean.datasource.DataSourcePool;
|
||||
import io.ebean.event.changelog.ChangeLogListener;
|
||||
import io.ebean.event.changelog.ChangeLogPrepare;
|
||||
import io.ebean.event.changelog.ChangeLogRegister;
|
||||
@@ -45,10 +44,10 @@ import io.ebeaninternal.server.changelog.DefaultChangeLogPrepare;
|
||||
import io.ebeaninternal.server.changelog.DefaultChangeLogRegister;
|
||||
import io.ebeaninternal.server.cluster.ClusterManager;
|
||||
import io.ebeaninternal.server.core.bootup.BootupClasses;
|
||||
import io.ebeaninternal.server.core.timezone.OracleDataTimeZone;
|
||||
import io.ebeaninternal.server.core.timezone.DataTimeZone;
|
||||
import io.ebeaninternal.server.core.timezone.MySqlDataTimeZone;
|
||||
import io.ebeaninternal.server.core.timezone.NoDataTimeZone;
|
||||
import io.ebeaninternal.server.core.timezone.OracleDataTimeZone;
|
||||
import io.ebeaninternal.server.core.timezone.SimpleDataTimeZone;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptorManager;
|
||||
import io.ebeaninternal.server.deploy.generatedproperty.GeneratedPropertyFactory;
|
||||
@@ -78,12 +77,10 @@ import io.ebeaninternal.server.query.QueryPlanLoggerSqlServer;
|
||||
import io.ebeaninternal.server.readaudit.DefaultReadAuditLogger;
|
||||
import io.ebeaninternal.server.readaudit.DefaultReadAuditPrepare;
|
||||
import io.ebeaninternal.server.text.json.DJsonContext;
|
||||
import io.ebeaninternal.server.transaction.AutoCommitTransactionManager;
|
||||
import io.ebeaninternal.server.transaction.DataSourceSupplier;
|
||||
import io.ebeaninternal.server.transaction.DefaultProfileHandler;
|
||||
import io.ebeaninternal.server.transaction.DefaultTransactionScopeManager;
|
||||
import io.ebeaninternal.server.transaction.DocStoreTransactionManager;
|
||||
import io.ebeaninternal.server.transaction.ExplicitTransactionManager;
|
||||
import io.ebeaninternal.server.transaction.ExternalTransactionScopeManager;
|
||||
import io.ebeaninternal.server.transaction.JtaTransactionManager;
|
||||
import io.ebeaninternal.server.transaction.NoopProfileHandler;
|
||||
@@ -100,7 +97,6 @@ import io.ebeanservice.docstore.none.NoneDocStoreFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -450,12 +446,6 @@ public class InternalConfiguration {
|
||||
indexUpdateProcessor, beanDescriptorManager, dataSource(), profileHandler(), logManager,
|
||||
tableModState, cacheNotify, clockService);
|
||||
|
||||
if (serverConfig.isExplicitTransactionBeginMode()) {
|
||||
return new ExplicitTransactionManager(options);
|
||||
}
|
||||
if (isAutoCommitMode()) {
|
||||
return new AutoCommitTransactionManager(options);
|
||||
}
|
||||
if (serverConfig.isDocStoreOnly()) {
|
||||
return new DocStoreTransactionManager(options);
|
||||
}
|
||||
@@ -492,18 +482,6 @@ public class InternalConfiguration {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if autoCommit mode is on.
|
||||
*/
|
||||
private boolean isAutoCommitMode() {
|
||||
if (serverConfig.isAutoCommitMode()) {
|
||||
// explicitly set
|
||||
return true;
|
||||
}
|
||||
DataSource dataSource = serverConfig.getDataSource();
|
||||
return dataSource instanceof DataSourcePool && ((DataSourcePool) dataSource).isAutoCommit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the TransactionScopeManager taking into account JTA or external transaction manager.
|
||||
*/
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
package io.ebeaninternal.server.transaction;
|
||||
|
||||
import java.sql.Connection;
|
||||
|
||||
/**
|
||||
* AutoCommit friendly Transaction.
|
||||
* <p>
|
||||
* Skips actual commit and rollback as these are performed automatically.
|
||||
*/
|
||||
public class AutoCommitJdbcTransaction extends JdbcTransaction {
|
||||
|
||||
public AutoCommitJdbcTransaction(String id, boolean explicit, Connection connection, TransactionManager manager) {
|
||||
super(id, explicit, connection, manager);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkAutoCommit(Connection connection) {
|
||||
// do nothing as autoCommit
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void performRollback() {
|
||||
// do nothing as autoCommit
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void performCommit() {
|
||||
// do nothing as autoCommit
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package io.ebeaninternal.server.transaction;
|
||||
|
||||
import io.ebeaninternal.api.SpiTransaction;
|
||||
|
||||
import java.sql.Connection;
|
||||
|
||||
/**
|
||||
* AutoCommit based TransactionManager.
|
||||
* <p>
|
||||
* Intended to be used if when autoCommit mode is desired.
|
||||
*/
|
||||
public class AutoCommitTransactionManager extends TransactionManager {
|
||||
|
||||
public AutoCommitTransactionManager(TransactionManagerOptions options) {
|
||||
super(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an autoCommit based Transaction.
|
||||
*/
|
||||
@Override
|
||||
protected SpiTransaction createTransaction(boolean explicit, Connection c) {
|
||||
return new AutoCommitJdbcTransaction(nextTxnId(), explicit, c, this);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package io.ebeaninternal.server.transaction;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* This only works for Postgres and H2 (and doesn't work for Oracle).
|
||||
* <p>
|
||||
* Uses explicit begin statement to start the transactions.
|
||||
*/
|
||||
public class ExplicitJdbcTransaction extends JdbcTransaction {
|
||||
|
||||
public ExplicitJdbcTransaction(String id, boolean explicit, Connection connection, TransactionManager manager) {
|
||||
super(id, explicit, connection, manager);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkAutoCommit(Connection connection) throws SQLException {
|
||||
// begin the transaction explicitly
|
||||
executeStatement("begin");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void performRollback() throws SQLException {
|
||||
// Postgres needs this explicit rollback statement when used with AutoCommit=true
|
||||
executeStatement("rollback");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void performCommit() throws SQLException {
|
||||
// Postgres needs this explicit commit statement when used with AutoCommit=true
|
||||
executeStatement("commit");
|
||||
}
|
||||
|
||||
private void executeStatement(String statement) throws SQLException {
|
||||
try (PreparedStatement stmt = connection.prepareStatement(statement)) {
|
||||
stmt.execute();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package io.ebeaninternal.server.transaction;
|
||||
|
||||
import io.ebean.config.dbplatform.DatabasePlatform;
|
||||
import io.ebeaninternal.api.SpiTransaction;
|
||||
|
||||
import java.sql.Connection;
|
||||
|
||||
/**
|
||||
* TransactionManager where the transactions start with explicit "begin" statement.
|
||||
*/
|
||||
public class ExplicitTransactionManager extends TransactionManager {
|
||||
|
||||
public ExplicitTransactionManager(TransactionManagerOptions options) {
|
||||
super(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a ExplicitJdbcTransaction.
|
||||
*/
|
||||
@Override
|
||||
protected SpiTransaction createTransaction(boolean explicit, Connection c) {
|
||||
return new ExplicitJdbcTransaction(nextTxnId(), explicit, c, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the initialise of OnQueryOnly with the intention not to use CLOSE with ExplicitJdbcTransaction.
|
||||
*/
|
||||
@Override
|
||||
protected DatabasePlatform.OnQueryOnly initOnQueryOnly(DatabasePlatform.OnQueryOnly dbPlatformOnQueryOnly) {
|
||||
|
||||
// first check for a system property 'override'
|
||||
String systemPropertyValue = System.getProperty("ebean.transaction.onqueryonly");
|
||||
if (systemPropertyValue != null) {
|
||||
return DatabasePlatform.OnQueryOnly.valueOf(systemPropertyValue.trim().toUpperCase());
|
||||
}
|
||||
|
||||
// default to rollback if not defined on the platform
|
||||
return dbPlatformOnQueryOnly == null ? DatabasePlatform.OnQueryOnly.ROLLBACK : dbPlatformOnQueryOnly;
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
package org.tests.transaction;
|
||||
|
||||
import io.avaje.config.Config;
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.Database;
|
||||
import io.ebean.DatabaseFactory;
|
||||
import io.ebean.Query;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.annotation.ForPlatform;
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.datasource.DataSourceConfig;
|
||||
import io.ebean.datasource.DataSourcePool;
|
||||
import io.ebean.datasource.pool.ConnectionPool;
|
||||
import org.junit.Test;
|
||||
import org.tests.model.basic.UTDetail;
|
||||
import org.tests.model.basic.UTMaster;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class TestAutoCommitDataSource extends BaseTestCase {
|
||||
|
||||
@ForPlatform({Platform.H2, Platform.POSTGRES})
|
||||
@Test
|
||||
public void test() throws SQLException {
|
||||
|
||||
Properties properties = Config.asProperties();
|
||||
|
||||
DataSourceConfig dsConfig = new DataSourceConfig();
|
||||
dsConfig.loadSettings(properties, "h2autocommit");//"pg"
|
||||
dsConfig.setAutoCommit(true);
|
||||
|
||||
DataSourcePool pool = new ConnectionPool("h2autocommit", dsConfig);
|
||||
|
||||
Connection connection = pool.getConnection();
|
||||
assertTrue(connection.getAutoCommit());
|
||||
connection.close();
|
||||
|
||||
DatabaseConfig config = new DatabaseConfig();
|
||||
config.setName("h2autocommit");
|
||||
config.loadFromProperties();
|
||||
config.setDataSource(pool);
|
||||
config.setDefaultServer(false);
|
||||
config.setRegister(false);
|
||||
|
||||
config.addClass(UTMaster.class);
|
||||
config.addClass(UTDetail.class);
|
||||
config.setDdlGenerate(true);
|
||||
config.setDdlRun(true);
|
||||
config.setDdlExtra(false);
|
||||
|
||||
config.setAutoCommitMode(true);
|
||||
|
||||
Database database = DatabaseFactory.create(config);
|
||||
|
||||
Query<UTMaster> query = database.find(UTMaster.class);
|
||||
List<UTMaster> details = query.findList();
|
||||
assertEquals(0, details.size());
|
||||
|
||||
UTMaster bean1 = new UTMaster("one1");
|
||||
UTMaster bean2 = new UTMaster("two2");
|
||||
UTMaster bean3 = new UTMaster("three3");
|
||||
|
||||
// use a different transaction to do final query check
|
||||
try (Transaction otherTxn = database.createTransaction()) {
|
||||
try (Transaction txn = database.beginTransaction()) {
|
||||
assertTrue(txn.getConnection().getAutoCommit());
|
||||
database.save(bean1);
|
||||
database.save(bean2);
|
||||
|
||||
details = database.find(UTMaster.class)
|
||||
.usingTransaction(otherTxn)
|
||||
.findList();
|
||||
assertEquals(2, details.size());
|
||||
|
||||
database.save(bean3);
|
||||
txn.rollback();
|
||||
}
|
||||
|
||||
details = database.find(UTMaster.class)
|
||||
.usingTransaction(otherTxn)
|
||||
.findList();
|
||||
assertEquals(3, details.size());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,178 +0,0 @@
|
||||
package org.tests.transaction;
|
||||
|
||||
import io.avaje.config.Config;
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.Database;
|
||||
import io.ebean.DatabaseFactory;
|
||||
import io.ebean.Query;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.annotation.ForPlatform;
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.config.JsonConfig;
|
||||
import io.ebean.datasource.DataSourceConfig;
|
||||
import io.ebean.datasource.DataSourcePool;
|
||||
import io.ebean.datasource.pool.ConnectionPool;
|
||||
import io.ebeaninternal.server.type.ScalarTypeLocalDate;
|
||||
import org.junit.Test;
|
||||
import org.tests.model.basic.UTDetail;
|
||||
import org.tests.model.basic.UTMaster;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class TestExplicitTransactionMode extends BaseTestCase {
|
||||
|
||||
@ForPlatform(Platform.H2)
|
||||
@Test
|
||||
public void test() throws SQLException {
|
||||
|
||||
Properties properties = Config.asProperties();
|
||||
|
||||
DataSourceConfig dsConfig = new DataSourceConfig();
|
||||
dsConfig.loadSettings(properties, "h2autocommit2");
|
||||
dsConfig.setAutoCommit(true);
|
||||
|
||||
DataSourcePool pool = new ConnectionPool("h2autocommit2", dsConfig);
|
||||
|
||||
Connection connection = pool.getConnection();
|
||||
assertTrue(connection.getAutoCommit());
|
||||
connection.close();
|
||||
|
||||
DatabaseConfig config = new DatabaseConfig();
|
||||
config.setName("h2autocommit2");
|
||||
config.loadFromProperties();
|
||||
config.setDataSource(pool);
|
||||
config.setDefaultServer(false);
|
||||
config.setRegister(false);
|
||||
config.setExplicitTransactionBeginMode(true);
|
||||
|
||||
config.addClass(UTMaster.class);
|
||||
config.addClass(UTDetail.class);
|
||||
config.setDdlGenerate(true);
|
||||
config.setDdlRun(true);
|
||||
config.setDdlExtra(false);
|
||||
config.addClass(ScalarTypeLocalDateAsString.class);
|
||||
|
||||
Database database = DatabaseFactory.create(config);
|
||||
|
||||
testJsonScalarType(database);
|
||||
|
||||
Query<UTMaster> query = database.find(UTMaster.class);
|
||||
List<UTMaster> details = query.findList();
|
||||
assertEquals(0, details.size());
|
||||
|
||||
UTMaster bean0 = new UTMaster("one0");
|
||||
Transaction txn0 = database.beginTransaction();
|
||||
try {
|
||||
database.save(bean0);
|
||||
txn0.rollback();
|
||||
} finally {
|
||||
txn0.end();
|
||||
}
|
||||
|
||||
// rollback as expected
|
||||
assertEquals(0, database.find(UTMaster.class).findCount());
|
||||
|
||||
UTMaster bean1 = new UTMaster("one1");
|
||||
UTMaster bean2 = new UTMaster("two2");
|
||||
UTMaster bean3 = new UTMaster("three3");
|
||||
|
||||
// use a different transaction to do final query check
|
||||
try (Transaction otherTxn = database.createTransaction()) {
|
||||
|
||||
Transaction txn = database.beginTransaction();
|
||||
try {
|
||||
database.save(bean1);
|
||||
database.save(bean2);
|
||||
|
||||
// not visible in other transaction
|
||||
Query<UTMaster> query2 = database.find(UTMaster.class);
|
||||
details = database.extended().findList(query2, otherTxn);
|
||||
assertEquals(0, details.size());
|
||||
|
||||
database.save(bean3);
|
||||
|
||||
txn.commit();
|
||||
|
||||
} finally {
|
||||
txn.end();
|
||||
}
|
||||
|
||||
// commit as expected
|
||||
details = database.find(UTMaster.class)
|
||||
.usingTransaction(otherTxn)
|
||||
.findList();
|
||||
|
||||
assertEquals(3, details.size());
|
||||
}
|
||||
}
|
||||
|
||||
private void testJsonScalarType(Database ebeanServer) {
|
||||
UTMaster bean = new UTMaster("one1");
|
||||
bean.setEventDate(LocalDate.of(2019, 04, 20));
|
||||
|
||||
String json = ebeanServer.json().toJson(bean);
|
||||
assertThat(json).isEqualTo("{\"name\":\"one1\",\"eventDate\":\"2019-04-20\"}");
|
||||
UTMaster jsonMaster = ebeanServer.json().toBean(UTMaster.class, json);
|
||||
assertThat(jsonMaster.getEventDate()).isEqualTo(LocalDate.of(2019, 4, 20));
|
||||
}
|
||||
|
||||
public static class ScalarTypeLocalDateAsString extends ScalarTypeLocalDate {
|
||||
|
||||
public ScalarTypeLocalDateAsString() {
|
||||
super(JsonConfig.Date.ISO8601);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void modelSaveWithTransaction() {
|
||||
|
||||
try (Transaction txn = DB.getDefault().createTransaction()) {
|
||||
|
||||
UTMaster bean1 = new UTMaster("otherSave");
|
||||
bean1.save(txn);
|
||||
assertThat(DB.find(UTMaster.class).usingTransaction(txn)
|
||||
.where().eq("name", "otherSave").findOne()).isNotNull();
|
||||
|
||||
bean1.deletePermanent(txn);
|
||||
assertThat(DB.find(UTMaster.class).usingTransaction(txn)
|
||||
.where().eq("name", "otherSave").findOne())
|
||||
.isNull();
|
||||
|
||||
UTMaster bean2 = new UTMaster("otherInsert");
|
||||
bean2.insert(txn);
|
||||
assertTrue(DB.find(UTMaster.class).usingTransaction(txn)
|
||||
.where().eq("name", "otherInsert").exists());
|
||||
|
||||
bean2.setDescription("changed description");
|
||||
bean2.update(txn);
|
||||
|
||||
assertThat(DB.find(UTMaster.class).usingTransaction(txn)
|
||||
.where().eq("name", "otherInsert").findOne())
|
||||
.isNotNull()
|
||||
.extracting(UTMaster::getDescription).contains("changed description");
|
||||
|
||||
UTMaster bean3 = new UTMaster("otherThree");
|
||||
bean3.save(txn);
|
||||
|
||||
assertThat(DB.find(UTMaster.class).usingTransaction(txn)
|
||||
.where().eq("name", "otherThree").findOne())
|
||||
.isNotNull();
|
||||
|
||||
bean3.delete(txn);
|
||||
|
||||
assertThat(DB.find(UTMaster.class).usingTransaction(txn)
|
||||
.where().eq("name", "otherThree").findOne())
|
||||
.isNull();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user