- 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