use of org.nutz.dao.test.meta.Country in project nutz by nutzam.
the class OneTest method delete_links.
@Test
public void delete_links() {
Base b = dao.fetchLinks(dao.fetch(Base.class, "red"), "country");
dao.deleteLinks(b, "country");
assertEquals(1, dao.count(Country.class));
}
use of org.nutz.dao.test.meta.Country in project nutz by nutzam.
the class OneTest method delete_with.
@Test
public void delete_with() {
Base b = dao.fetchLinks(dao.fetch(Base.class, "red"), "country");
dao.deleteWith(b, "country");
assertEquals(1, dao.count(Country.class));
assertEquals(1, dao.count(Base.class));
}
use of org.nutz.dao.test.meta.Country in project nutz by nutzam.
the class OneTest method update_links_as_list.
@Test
public void update_links_as_list() {
List<Base> b = dao.fetchLinks(Lang.list(dao.fetch(Base.class, "red")), "country");
int lv = b.get(0).getLevel();
b.get(0).setLevel(45);
b.get(0).getCountry().setName("ABC");
dao.updateLinks(b, "country");
b = Lang.list(dao.fetch(Base.class, "red"));
assertEquals(lv, b.get(0).getLevel());
Country c = dao.fetch(Country.class, b.get(0).getCountryId());
assertEquals("ABC", c.getName());
}
use of org.nutz.dao.test.meta.Country in project nutz by nutzam.
the class CustomizedSqlsTest method test_statice_null_field.
@Test
public void test_statice_null_field() {
pojos.init();
Sql sql = Sqls.create("INSERT INTO dao_country (name,detail) VALUES(@name,@detail)");
sql.params().set("name", "ABC").set("detail", "haha");
dao.execute(sql);
assertEquals(1, dao.count("dao_country"));
sql = Sqls.create("UPDATE dao_country SET detail=@detail WHERE name=@name");
sql.params().set("name", "ABC").set("detail", null);
dao.execute(sql);
Country c = dao.fetch(Country.class, "ABC");
assertNull(c.getDetail());
}
use of org.nutz.dao.test.meta.Country in project nutz by nutzam.
the class OneTest method update_with.
@Test
public void update_with() {
Base b = dao.fetchLinks(dao.fetch(Base.class, "red"), "country");
b.setLevel(6);
b.getCountry().setName("ABC");
dao.updateWith(b, "country");
b = dao.fetch(Base.class, b.getName());
assertEquals(6, b.getLevel());
Country c = dao.fetch(Country.class, b.getCountryId());
assertEquals("ABC", c.getName());
}