开发者

hibernate hql left join

I have the following query

select x.a, x.b, y.a, y.b
from x, y
where y.xid = x.id

how do I per开发者_开发百科form a left join here.

I cannot use the following style so please do not suggest the following.

select x.a, x.b, y.a, y.b
from x left join x.y as y


When you don't have a relationship between x and y, you can't express an outer join between them in HQL.

Thus, you have to create a relationship or use a native SQL query with left join.

If y has a relationship to x, you can rewrite left join as right join:

select ... from y y right join y.x x
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜