当前位置: 代码迷 >> Java Web开发 >> HIBERNATE 级联查询有关问题,求教O(∩_∩)O
  详细解决方案

HIBERNATE 级联查询有关问题,求教O(∩_∩)O

热度:4531   发布时间:2013-02-25 21:22:21.0
HIBERNATE 级联查询问题,求教O(∩_∩)O
Java code
//classroom MAPPINGpublic class Classroom {private String id ;private String name;private Student student;//SETTER AND GETTER;


Java code
//student MAPPINGpublic class Student {private String uid ;private String uname;private String upsw;//SETTER AND GETTER;



Java code
//执行方法public List<Classroom > getClassroom (String cid) {String hql = " from Classroom where id="+cid;List<Classroom > classroomlist = getHibernateTemplate().find(hql);return classroomlist ;


现状:getClassroom (String cid)会产生2条语句,一条是查询Class表的。另一条是查询Student 表的。

问:这就是级联查询?如何控制(取消)?请各位帮帮忙,呵呵

------解决方案--------------------------------------------------------
你的classroom里是不是配置了student关联,将配置设置为lazy=true
  相关解决方案