开发者

Can we use union in hibernate?

Does anybody have any idea about unions in hibe开发者_如何学Crnate?

I got this question in a interview. My guess is yes, but I'm not sure where and when.


The answer is no... see here https://www.hibernate.org/117.html#A21


Even though you can't do a true union, you can simulate one if the union is for two different queries for the same entity. In that case, you can use a Disjunction to OR two or more different DetachedCriteria queries, using the output of those queries as inputs to a Restrictions.in against some column in the main entity. This method gets you the equivalent of a union.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜