@Table("t_master")
public class Master extends Pojo {
@Many(field = "masterId")
// 1.r.59之前需要写target参数
// @Many(target = Pet.class, field = "masterId")
private List<Pet> pets;
public List<Pet> getPets() {
return pets;
}
public void setPets(List<Pet> pets) {
this.pets = pets;
}
}
Master master = dao.fetch(Master.class, "Peter");
dao.fetchLinks(master, "pets");
如何使得查询出来的pets按照某属性排序
类似执行:
执行 SQL: SELECT * FROM t_master WHERE name='Peter'; // 如果 master.id 是 12
执行 SQL: SELECT * FROM t_pet WHERE masterId=12 order by name desc;