All,
I'm probably over-analyzing this problem, but...
Given table "A" with two one-to-many relationships "A1" and "A2", return all records in table "A" that have at least one child record in either table "A1" or "A2"...
I'm not necessarily interested in knowing what the child data is, but rather that I just have child data.
Thanks!
You need a Restrictions.isNotEmpty() criterion:
List<A> r = s.createCriteria(A.class)
.add(Restrictions.or(
Restrictions.isNotEmpty("a1"),
Restrictions.isNotEmpty("a2"))).list();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With