How to make Minus HQL

I have a table A {id, foo, ...} and a table B {id, boo, idA} I want all objects in A that identifiers do not appear in B

in Oracle SQL will look like this:

SELECT id FROM A MINUS( SELECT idA FROM B);
+4
source share
2 answers

Easier than I thought, I focused on the minus

select a.id from A as a where a.id not in (select idA from B)

thanks

+1
source

The MINUS function does not exist in HQL, go here to paragraph 14.10. Expressions.

Try the following:

SELECT id FROM A
WHERE NOT EXISTS
    (SELECT 'X' FROM B WHERE B.idA = A.id)
+5
source

All Articles