-->
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: Query Uni-directional one-to-many Question
PostPosted: Wed May 02, 2007 10:22 pm 
Newbie

Joined: Wed Apr 11, 2007 2:03 am
Posts: 5
Hi guys

I have a Parent and Child with a one-to-many uni-directional relationship. When I try to get all the Parent with a Child of a certain criteria (say age=8). I have a n+1 selection problem.

Hibernate will first look into the Child table to get all Parent id who got a child age=8. And then it will do a select for all the Parent Id it retrieved in the above select.

Is there anyway to improve the performance? How to prevent this n+1 selection from happening?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 02, 2007 10:54 pm 
Senior
Senior

Joined: Sat Aug 19, 2006 6:31 pm
Posts: 139
I think hibernate does a join. But there's no way to get around having to look at each child to see if it's got an age = 8.

_________________
Don't forget to rate the reply if it helps..:)

Budyanto


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.