日期:2014-05-17  浏览次数:20698 次

hibernate一对多查询问题?
求助:
比如 Student表和books表是一对多的关系;
现在要查询 没有分配书的学生 用HQL怎么查;

------解决方案--------------------
book表中应该有student的外键字段,用子查询

hql ="from Student s where s.id not in (select b.student.id from Books b )"