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.  [ 1 post ] 
Author Message
 Post subject: one-to-one id generation problem
PostPosted: Mon Jan 10, 2005 10:51 am 
Newbie

Joined: Wed Jan 21, 2004 5:12 pm
Posts: 8
Hibernate version: 2.1.7c

I have a situation where I am using a one-to-one mapping in a class, using the generated (native hibernate id generator on mysql) primary key of the left side of the one to one as key for the right (foreign id generator) side. My motive for doing this is that I want the right side to be lazily loaded since it is expensive to load if not really necessary( it contains a blob ). This class is declared lazy="true", and has a proxy attribute defined.

The only way I"ve found that I can get the lazy loading to work is to put constrained = "true" on the left side one-to-one property. When I do this lazy loading does work, but when I do that I can no longer insert objects of this type because hibernate tries to insert the right side object first, and doesn't have an id for the foriegn id generator. I am certain that there is a way to do this, as hibernate has not let me down yet, I'm just not clear about what I need to set to do this correctly.

Any ideas?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.