mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1113 - SqlUpdate with leading spaces leads to Invalid event detection (which table was update for L2 cache invalidation etc)
This commit is contained in:
@@ -3,9 +3,13 @@ package org.tests.rawsql;
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.SqlUpdate;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebeaninternal.api.SpiTransaction;
|
||||
import org.tests.idkeys.db.AuditLog;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
||||
public class TestInsertSqlLogging extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
@@ -20,6 +24,22 @@ public class TestInsertSqlLogging extends BaseTestCase {
|
||||
sqlUpdate.setParameter(3, "rob");
|
||||
|
||||
sqlUpdate.execute();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_trim_leadingSpaces_eventFound() {
|
||||
|
||||
Transaction transaction = Ebean.beginTransaction();
|
||||
try {
|
||||
String upd = " update audit_log set description='junk' where id = 10001";
|
||||
SqlUpdate update = Ebean.createSqlUpdate(upd);
|
||||
update.execute();
|
||||
transaction.commit();
|
||||
|
||||
assertFalse(((SpiTransaction) transaction).getEvent().getEventTables().isEmpty());
|
||||
|
||||
} finally {
|
||||
transaction.end();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user