mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1504 - ENH: Add SqlUpdate executeNow() method ... that executes now regardless of transaction batch mode
Add test for UpdateQuery (which executes immediately regardless)
This commit is contained in:
@@ -42,6 +42,32 @@ public class UpdateQueryTest extends BaseTestCase {
|
||||
assertThat(ormQueryMetrics.get(0).getLabel()).isEqualTo("updateActive");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void update_withTransactionBatch() {
|
||||
|
||||
EbeanServer server = server();
|
||||
|
||||
try (Transaction transaction = server.beginTransaction()) {
|
||||
transaction.setBatchMode(true);
|
||||
|
||||
UpdateQuery<Customer> update = server.update(Customer.class);
|
||||
|
||||
Query<Customer> query = update
|
||||
.set("status", Customer.Status.ACTIVE)
|
||||
.set("updtime", new Timestamp(System.currentTimeMillis()))
|
||||
.where()
|
||||
.eq("status", Customer.Status.NEW)
|
||||
.gt("id", 99999)
|
||||
.query();
|
||||
|
||||
// update executes now regardless of transaction batch mode
|
||||
int rows = query.update();
|
||||
assertThat(rows).isEqualTo(0);
|
||||
|
||||
transaction.commit();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@IgnorePlatform(Platform.SQLSERVER)
|
||||
public void withTableAlias() {
|
||||
|
||||
Reference in New Issue
Block a user