开发者

Does Hibernate HQL support aliasing subqueries?

I'm using Hibernate 3.2.6 and I'm attempting to make a query like so:

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

Imagine that this query makes sense in the context that I'm operating in. When I run this query, I get an err开发者_StackOverflow社区or saying "Unknown column 'someAlias' in 'where clause'". When I show the SQL output, I see that SQL doesn't seem to include the 'as someAlias' part of the query.

Is this just unsupported, or am I missing something? Or this just a feature not supported in version of Hibernate?


Translate the query to native sql and fire it on db, it will not work.It is not a valid query because aliases in select clause will not be visible in where clause.

Aliases are supported in HQL.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜