use of jodd.db.oom.tst.BadGirl in project jodd by oblac.
the class DbEntitySqlTest method testDelete.
@Test
public void testDelete() {
Girl g = new Girl(1, "sanja", "c++");
DbSqlBuilder b = DbEntitySql.delete(g);
assertEquals("delete from GIRL where (GIRL.ID=:girl.id and GIRL.NAME=:girl.name and GIRL.SPECIALITY=:girl.speciality)", b.generateQuery());
checkGirl(b);
BadGirl bg = new BadGirl(Integer.valueOf(2), null, ".net");
b = DbEntitySql.delete(bg);
assertEquals("delete from GIRL where (GIRL.ID=:badGirl.fooid and GIRL.SPECIALITY=:badGirl.foospeciality)", b.generateQuery());
checkBadGirl1(b);
b = DbEntitySql.deleteByAll(bg);
assertEquals("delete from GIRL where (GIRL.ID=:badGirl.fooid and GIRL.NAME=:badGirl.fooname and GIRL.SPECIALITY=:badGirl.foospeciality)", b.generateQuery());
checkBadGirl2(b);
b = DbEntitySql.deleteById(bg);
assertEquals("delete from GIRL where (GIRL.ID=:badGirl.fooid)", b.generateQuery());
checkBadGirl3(b);
b = DbEntitySql.deleteById(bg, 2);
assertEquals("delete from GIRL where GIRL.ID=:p0", b.generateQuery());
checkBadGirl4(b);
}
Aggregations