-->
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: Is this the problem with lazy one-to-one?
PostPosted: Thu Jul 15, 2004 9:52 am 
Beginner
Beginner

Joined: Mon Nov 03, 2003 11:48 pm
Posts: 29
I have my code posted in http://forum.hibernate.org/viewtopic.php?t=932541 Do lazy loading one-to-one mappings, database generated Ids, and cascading inserts just not go together? Is this because the constrained clause is used for two purposes?

    purpose 1) tell hibernate which side of the mapping to load first
    purpose 2) tell hibernate wether or not a mapped is required.


It seems, on the parent, I have to set constrained = false if I wish to save the parent, get the identity column generated id and then save the child. I need to set constrained = true on the parent if I wish to lazy load the child. What am I missing? It seems that the only way to resolve this is save the child manually instead of letting hibernate use a cascading save. Should I submit this as a bug or am I just confused?
--Angus


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 15, 2004 11:56 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Correct. For a one-to-one association, lazy fetching is ONLY possible if constrained=true (otherwise, we can't know if the association is null w/o hitting db).


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 15, 2004 11:58 am 
Beginner
Beginner

Joined: Mon Nov 03, 2003 11:48 pm
Posts: 29
So, are lazy loading one-to-one and foriegn key child generation incompatible? Should they be?


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.