Reputation: 123
Does anybody have any idea about unions in hibernate?
I got this question in a interview. My guess is yes, but I'm not sure where and when.
Upvotes: 6
Views: 6077
Reputation: 9255
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.
Upvotes: 3
Reputation: 16529
The answer is no... see here https://www.hibernate.org/117.html#A21
Upvotes: 3