开发者

Can we use union in hibernate?

开发者 https://www.devze.com 2022-12-16 02:32 出处:网络
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.hibe

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

精彩评论

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