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: trouble with a 1 to zero 1 mapping
PostPosted: Mon Sep 11, 2006 3:37 pm 
Newbie

Joined: Mon Aug 28, 2006 5:41 pm
Posts: 2
Hi all,
I am having trouble creating a mapping for a one to 0..1 relationship in my database. I am working with a database that is already created and can not be changed. In my database I have an article object. Articles have abstracts associated with them in a different table that shares a primary key with my articles table. However not all articles have an abstract. Ideally the behavior I would like to see is that if I retrieve an Article from the database that has an abstract. The abstract field of my article domain object will be instantiated and contain the abstract from the database. However, if no abstract exist the Abstract field and property should return null. Is this possible with Nhibernate and if so how would I go about doing this? I found one suggestion online that I should use a many-to-one mapping with an unique attribute but I could not get this to work as I described above. Any help would be greatly appreciated.
Sincerely,
Adam Carasso


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 11, 2006 7:52 pm 
Newbie

Joined: Mon Aug 28, 2006 5:41 pm
Posts: 2
well after playing some more with my debugger I realized that the behavior I want occurs when lazy initilization on the Abstract class is set to false. It would still be nice to have a way to do this with lazy initilazation but I will take what I can get.


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.