#1167 - BUG: query.setId(...).delete() does not work

This commit is contained in:
Rob Bygrave
2017-10-16 22:58:48 +13:00
parent 5869187368
commit 96a4b93c75
5 changed files with 25 additions and 5 deletions
@@ -51,6 +51,22 @@ public class TestDeleteByQuery extends BaseTestCase {
assertThat(list).isEmpty();
}
@Test
public void queryByIdDelete() {
LoggedSqlCollector.start();
Ebean.find(Contact.class).where().eq("id", 7000).delete();
Ebean.find(Contact.class).setId(7000).delete();
List<String> sql = LoggedSqlCollector.stop();
assertThat(sql.get(0)).contains("delete from contact where id = ?");
assertThat(sql.get(1)).contains("delete from contact where id = ?");
// and note this is the easiest option
Ebean.delete(Contact.class, 7000);
}
@Test
public void testWithForUpdate() {