Even if you cannot make a real union, you can imitate it if the union is for two different queries for the same object. In this case, you can use Disjunction to OR two or more different DetachedCriteria queries, using the output of these queries as inputs to Restrictions.in for some column in the main entity. This method gives you the union equivalent.
atrain
source share