These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Possible to filter this way with Criteria?
PostPosted: Mon Dec 01, 2008 9:57 pm 
Newbie

Joined: Mon Dec 01, 2008 8:20 pm
Posts: 1
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!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.