0
我使用Hibernate 3.2.6,我試圖使像這樣的查詢:Hibernate HQL是否支持別名子查詢?
select
a,
(select min(date) as someAlias from B b where a.id = b.id)
from A a
where someAlias is not null and someAlias between :start and :end
想象,這個查詢有道理在我參與的運作環境。當我運行此查詢。 ,我在'where子句'中收到一個錯誤,說「未知列'someAlias'」。當我顯示SQL輸出,我看到SQL似乎不包括查詢的「爲someAlias」的一部分。
這只是不支持的,還是我失去了一些東西?或者這只是Hibernate版本中不支持的功能?
這是有道理的。我習慣於在join或from子句中進行子查詢,在這裏可以設置別名。當然,HQL不支持子查詢那裏,所以我又回到了起點1與此查詢,但感謝你回答的問題。 – lakemalcom 2011-04-06 16:59:25