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.  [ 3 posts ] 
Author Message
 Post subject: Restrictions on a Child object ?
PostPosted: Wed Jan 06, 2010 10:57 am 
Newbie

Joined: Thu Nov 12, 2009 4:32 pm
Posts: 16
if i am calling a parent object with some Criteria Restrictions, how do i set any restrictions on the child object ?

any inputs will be a great help,

Here is how i am doing on the parent object

Criteria cri = session.createCriteria(ParentBean.class)
.add(Restrictions.eq("status", "A"));



DP


Top
 Profile  
 
 Post subject: Re: Restrictions on a Child object ?
PostPosted: Wed Jan 06, 2010 4:42 pm 
Newbie

Joined: Thu Nov 12, 2009 4:32 pm
Posts: 16
can somebody answer this question please.


Top
 Profile  
 
 Post subject: Re: Restrictions on a Child object ?
PostPosted: Wed Jan 13, 2010 3:11 am 
Newbie

Joined: Wed Dec 23, 2009 12:38 pm
Posts: 14
Are you looking for something like this?

Category has types as well as areas [ Type and Area collection ]

I am firing this query to include some restriction on the children as well.

Criteria crit = session.createCriteria(Category.class).createAlias("types","type").createAlias("areas", "area")
.add(Restrictions.like("type.name", "first")).add(Restrictions.like("area.name", "first"));


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

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.