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.
|