-->
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: HQL to retrieve a parent fetching only 1 of its children
PostPosted: Thu Dec 06, 2007 8:12 am 
Newbie

Joined: Tue Aug 21, 2007 7:03 am
Posts: 2
I am having difficulties creating a HQL query to retrieve a Parent object and fetching only one child from its set of children via an outer join. The join condition is to retieve the child given its database id.

I have noticed in the documentation that you can add join conditions via 'with' but it rejects asking for a filter.

Thank you for your time,
James.


Top
 Profile  
 
 Post subject: Re: HQL to retrieve a parent fetching only 1 of its children
PostPosted: Thu Dec 06, 2007 12:44 pm 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
jamesaperry wrote:
I am having difficulties creating a HQL query to retrieve a Parent object and fetching only one child from its set of children via an outer join. The join condition is to retieve the child given its database id.

I have noticed in the documentation that you can add join conditions via 'with' but it rejects asking for a filter.

Thank you for your time,
James.


Why don't you select the child object by its db id and have hibernate set its parent property? (in case it is bidirectional)


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.