-->
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: Simple (newbie) many-to-one mapping question
PostPosted: Sun Jun 12, 2005 12:45 am 
Beginner
Beginner

Joined: Thu Feb 17, 2005 6:04 pm
Posts: 23
Hello,

I've got a simple mapping question for you more experienced Hibernate users...

In my old legacy DB, I have two tables - one defining Mail Triggers, and one for Mail Content. Each trigger (usually) is associated to one MailContent row through the use of a non-enforced foreign key (mysql).

I configured MailTriggers to have a many-to-one relationship to MailContent, and this normally works great. I load a MailTrigger, and I have direct access to the mail content data (two rows were loaded automatically for me - one from each table).

Trouble is when that foreign key is null! Having mail content defined for each mail trigger is in fact optional.

In this case, hibernate throws an exception, and doesn't return data from either table!

What should I do? I have "worked around" the problem by using lazy initialization, but I'm not sure this is the good solution...

It would better suit our data model if the related item were set to null.

Thanks!

Mal.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 12, 2005 6:58 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
try hibernate3 - I think that it work

regards


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.