-->
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-one referred by ID only
PostPosted: Mon Nov 05, 2007 8:31 pm 
Newbie

Joined: Wed Feb 07, 2007 7:55 pm
Posts: 18
I have a situation of one-to-one relationship that I prefer the child class is referred with its ID instead of object on its parent class for the following reason:

When the parent object is retrieved along with the child, two DB trips are need: first to get the parent object and second to get the child object. The child object is a binary image file. To display it on a web page, I need to use a servlet for the task.

My question is whether the Hibernate can take care this situation so that I can't need to do anything manually on child object deletion or replacement or not.

Thanks for your input in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 11, 2007 4:05 pm 
Regular
Regular

Joined: Wed Aug 25, 2004 7:40 pm
Posts: 65
For such case, it might be better without an one-to-one mapping. Having the child object ID as an attribute of the parent will be an favorable approach.


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.