-->
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.  [ 1 post ] 
Author Message
 Post subject: Sorting on Foregin Object's field
PostPosted: Fri Jul 04, 2008 11:40 pm 
Newbie

Joined: Wed May 21, 2008 2:17 am
Posts: 2
Location: Hong Kong
In a many-to-one relationship, let say the entities are User and Organization where one organization may have thousands of users and user may not have an organization.

In the User.hbm.xml, I set fetch="join" in the <many-to-one /> tag. The SQL generated for fetching the User uses LEFT OUTER JOIN. However, If I perform a query on User with a sorting option on one of the field in Organization (say organization.name), the SQL generated becomes INNER JOIN.

As a result, I would get a wrong result set since user may not have an organization. Those records will be losen by INNER JOIN.

Thanks for advance.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.