編輯:具體談論沒有表查詢。是的,我可以用存在,但我不得不這樣做如何選擇行中是否存在HQL
select case when exists (blah) then 1 else 0 end as conditionTrue
from ARealTableReturningMultipleRows
在T-SQL我可以這樣做:
select case when exists(blah) then 1 else 0 end as conditionTrue
在Oracle我可以這樣做:
select case when exists(blah) then 1 else 0 end as conditionTrue from DUAL
如何在HQL中實現同樣的功能?
select count()似乎是第二好的選擇,但如果我不需要,我不想處理表中的每一行。
看看這個問題:http://stackoverflow.com/questions/3672444/where-exists-in-hibernate-hql – 2011-02-03 20:35:41