-->
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: How to map tables with outer join for missing constraints
PostPosted: Wed Aug 06, 2008 8:30 pm 
Newbie

Joined: Tue Dec 07, 2004 8:15 pm
Posts: 10
Location: Adelaide Australia
I am trying to map a legacy database which has relationships with no foreign key constraints. This means that occasionally table A will have a value for the primary key of table B but that value will not exist in table B. What I would like is an outer join mapping that makes the class association null in this case instead of throwing an exception.

Is this a simple matter of putting fetch=join on the many-to-one mapping?

Hibernate version:
3.2.6
Mapping documents:
None yet
Code between sessionFactory.openSession() and session.close():
N/A
Full stack trace of any exception that occurs:
N/A
Name and version of the database you are using:
Oracle 10g
The generated SQL (show_sql=true):
N/A
Debug level Hibernate log excerpt:
N/A

_________________
Peter Kelley


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 07, 2008 1:41 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
The <many-to-one> declaration can take a not-found attribute. Possible values are ignore and exception (the default).
See http://www.hibernate.org/hib_docs/v3/re ... -manytoone


Top
 Profile  
 
 Post subject: Thankyou
PostPosted: Thu Aug 07, 2008 4:36 am 
Newbie

Joined: Tue Dec 07, 2004 8:15 pm
Posts: 10
Location: Adelaide Australia
Yes! Thanks for that, all is working now.

_________________
Peter Kelley


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.