use of org.nutz.dao.sql.Pojo in project nutz by nutzam.
the class Pojos method pojo.
public static Pojo pojo(JdbcExpert expert, Entity<?> en, SqlType type) {
Pojo pojo = expert.createPojo(type);
pojo.getContext().setFieldMatcher(FieldFilter.get(en.getType()));
return pojo;
}
use of org.nutz.dao.sql.Pojo in project nutz by nutzam.
the class NutPojoMakerTest method makeQueryByJoin.
@Test
public void makeQueryByJoin() {
dao.create(Pet.class, true);
dao.create(Master.class, true);
Master master = new Master();
master.setName("zozoh");
Pet petA = new Pet();
petA.setName("wendal");
petA.setAge(31);
Pet petB = new Pet();
petB.setName("pangwu");
petB.setAge(30);
master.setPets(Arrays.asList(petA, petB));
dao.insertWith(master, null);
PojoMaker pojoMaker = new NutPojoMaker(dao.getJdbcExpert());
Entity<?> en = en(Master.class);
Pojo pojo = pojoMaker.makeQueryByJoin(en, "pets");
assertEquals(true, Lang.isNotEmpty(pojo));
}
Aggregations