Search in sources :

Example 6 with BadGirl

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);
}
Also used : BadGirl(jodd.db.oom.tst.BadGirl) BadGirl(jodd.db.oom.tst.BadGirl) Girl(jodd.db.oom.tst.Girl) Test(org.junit.Test)

Aggregations

BadGirl (jodd.db.oom.tst.BadGirl)6 Test (org.junit.Test)6 Girl (jodd.db.oom.tst.Girl)4 BadBoy (jodd.db.oom.tst.BadBoy)2 DbSqlBuilder (jodd.db.oom.sqlgen.DbSqlBuilder)1