-->
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: Mapping One-to-many when "one" is nullable?
PostPosted: Fri Jun 16, 2006 10:26 am 
Beginner
Beginner

Joined: Tue Aug 26, 2003 4:19 pm
Posts: 42
I would like to map a many to one relationship between two tables, but the keys on the "many" side don't have a foreign key constraint, because the records on the "many" side can exist in the domain without a corresponding "one" record.

When I pull back an entity where the "one" side is populated, my many-to-one relationship works fine. When the "one" side is null, I get an ObjectNotFoundException.

Is there any way to map the relationship such that the getter will simply return null rather than throwing an exception?


Top
 Profile  
 
 Post subject: yes
PostPosted: Tue Jun 27, 2006 6:55 am 
Newbie

Joined: Sat Jun 03, 2006 5:36 pm
Posts: 8
<many-to-one not-found="ignore" ..


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.