mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-10-24 23:56:36 +00:00
#455 - Should not generate "FOR UPDATE" for delete query
This commit is contained in:
@@ -435,6 +435,7 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
|
||||
// includes joins and we use - delete ... where id in (...)
|
||||
maxRows = 0;
|
||||
firstRow = 0;
|
||||
forUpdate = false;
|
||||
setSelectId();
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,21 @@ public class TestDeleteByQuery extends BaseTestCase {
|
||||
assertThat(list).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithForUpdate() {
|
||||
|
||||
EbeanServer server = Ebean.getDefaultServer();
|
||||
if (server.getName().equals("mysql")) {
|
||||
// MySql does not the sub query selecting from the delete table
|
||||
return;
|
||||
}
|
||||
|
||||
server.find(Customer.class)
|
||||
.where().eq("name","FatsDomino")
|
||||
.query().setForUpdate(true)
|
||||
.delete();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCommit() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user