I have two tables joined together with entities like this (entities anonymized, and trimmed of irrelevant properties):
Email – Email_ID – Title – Body (hibernate uses a Body_ID field here)
Body – Body_ID – Body_Text
I’d like to retrieve all Email entries that do not have an associated Body row (ie, Body_ID is null). What HQL would do this?
Assuming you have an Email object with a @OneToOne or @ManyToOne to Body:
select e from Email as e where e.body is null