I have been trying to figure this out for a few days and still haven't had any luck. I'm hoping that there is a simple obvious solution to this that I am overlooking, apologies if there are similar posts, I tried searching.
Basically, let's say I want a list of Parents that have a child named Jane.
The parent class has a List of children.
If I do the query like the following, it works for a parent that has one child named Jane, or one with two kids both named Jane, but it won't include another parent who has a child named Jane and a child named John. I need to be able to find out if any of a parents children are named Jane, not if all of them are...is there a way to specify this?
Criteria crit = session.createCriteria(Parent.class, "p")
.createCriteria("children", "c")
.add(Expression.ilike("p.name", "Jane"));
I appreciate any help, thanks!
|