0

I have the following structure:

Invoice <->> LineItem

How do I write an Expression that will query the database for all the Invoice objects that do not have any related LineItem objects?

There is no Invoice.LINE_ITEMS.isEmpty() and Invoice.LINE_ITEMS.isNull() will not work because myInvoice.getlineItems() will return an empty collection not null.

David Avendasora
  • 4,538
  • 1
  • 16
  • 15

1 Answers1

2

If you do an outer join using the null check should work. Write your expression like this:

Invoice.LINE_ITEMS.outer().isNull()

Hugi
  • 202
  • 2
  • 7