-->
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.  [ 2 posts ] 
Author Message
 Post subject: one-to-many filter one-to-many set
PostPosted: Sat Dec 02, 2006 2:15 pm 
Newbie

Joined: Tue Apr 25, 2006 2:08 am
Posts: 7
Hi All

I have 2 objects. I have a Parent class and a children class. This is a one-to-many relation. The parent has 0 or more children.

The mapping works fine but the problem is I need to filter the children set. For example:

The database has 1 parent (Parent1) and 3 children (Child1, Child2, Child3). When I execute the HQL query:
select P1 from Parent P1 LEFT JOIN Child C1 WHERE C1.Nae='Child2'

I get 1 parent object. That is correct but the children set in the parent object contains 3 children. This is correct. I would like to know how can I initialize the children set so that only children with a certain name are loaded into the set.

I must advise. I'm using spring so I am using getHibernateTemplate() and not the session object to execute queries.

Any help would be appreciated.
Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 03, 2006 6:32 pm 
Newbie

Joined: Sat Dec 02, 2006 10:55 pm
Posts: 10
Try making a proxy relation which can sort of map something like parent id's to child ids and going from there


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.