Hibernate recognises HQL not SQL.
Quote:
I want to get all the objects that don't have a corresponding object joined to it.
I would do this in HQL:
Code:
FROM myTable AS t
WHERE
t.fieldToMyTable IS NULL
And in regards to your second question. The SQL stament is weird:
- t2.Id is null? how does a table has a row that does not have an id? should this write t2.FK is null?
Anyway, I would do this instead:
Code:
FROM item AS i
WHERE
i.myGroup = :newGroup AND
i NOT EXISTS (
FROM item AS i2
WHERE
i2.myGroup = :myGroup
)