use of org.nutz.dao.sql.PojoMaker 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));
}