my question is how i perform UNION ALL clause in JPA ? is it possible to use @NamedQuery? this query using 2 tables at a time in each SELECT statement and at the end it is using ORDER BY
SELECT 0 as intorder, u.id, q.order_type
FROM test_union u, test_query q
WHERE u.id = q.id
AND u.type is NULL
AND q.field1 = 'DEFAULTS'
UNION ALL
SELECT 1 as intorder, u.id, q.order_type
FROM test_union u, test_query q
WHERE u.id = q.id
AND u.type is NOT NULL
AND q.field1 = 'TESTING'
UNION ALL
SELECT 2 as intorder, u.id, q.order_type
FROM test_union u, test_query q
WHERE u.id = q.id
AND u.type is NULL
AND q.field1 = 'DEFAULTS'
ORDER BY intorder, q.order_type;