-->
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: left joins in hibernate
PostPosted: Mon Jan 12, 2004 9:41 am 
Newbie

Joined: Sat Jan 03, 2004 6:34 pm
Posts: 3
quoting rick:
Quote:
Say I have a Customer object, and one of the mappings is many-to-one for a ZipCity. The ZipCity table maps zip codes to city names, but isn't 100% complete, so I'm going to need outer joins for it all to work, allowing customers with null ZipCity objects.

Most Customers have a zip that will map, but say one has a zip code that isn't in the ZipCity table.

This is where hibernate does indeed get all the outer joined records. In normal sql, that data for the joined zip that doesn't exist would have null data.

But hibernate seems to do another query on the ZipCity table to load that unjoined zip, and it fails, and the entire query fails.

Boy even this sounds confusing, I don't know how to distill it more! Bottom line is I would be ok if the first query just came back and left a null Zip object in there, but that second attempt kills me.

rick

I have the same problem here.
It seems to me a very common situation (specially when working with legacy data) that has not a fairly simple solution. Any comments on this would be appreciated.
Thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 12, 2004 9:45 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Well I think there could be a way to make it work by relying as much as possible on Proxys and lazy loading. Check the SQL Hibernate generates and try to avoid the not working querys by using lazy loading. Not however that Hibernate is not designed to work around a broken relational model, like foreign keys for which do not exist as primary key in the related table.


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.