一年前发的帖子:http://topic.csdn.net/u/20100510/15/284817f8-820d-434d-8e15-1c3099bbcde3.html,都忘记这问题了,今天突然看到消息有人回复了,看下了,有人给解决了,可开心了,纪念下。
Person类和User类一一对应,映射关系如下
我想从person中查询还未配上User的person列表
可是没实现我要的结果,myeclipse后台输出的hibernate语句是的后半部分是
怎么会是 person0_.id is not null,怎么就给变成 person0_.id呢,我要怎么写才能实现我要的功能
感谢 MaracMo 的回答:
我今天也碰到了这个问题,研究了下,可以用以下语句查出来:
from Person as p left join p.user as u where u is null.
hibernate默认情况下对关联属性的查询是采用inner join策略,因此
from Person as p where p.user is null 语句是查不到user属性为空的person对象的!