I have the same issue but the child is loading eagerly in separate select statements for no reason:
I have a user and user_termination tables with only the user_termination having the user_id as the foreign key as the user may or may not be terminated (may not have a user_termination entry)!
I defined the userTermination mapping in user as
Code:
<one-to-one name="userTermination" class="UserTermination"
property-ref="user" lazy="no-proxy">
</one-to-one>
And the userTermination has a user entry as a many-to-one
Code:
<many-to-one name="participant" class="Participant" column="participant_id" unique="true" not-null="false" />
I chose lazy="no-proxy" in my parent however, whenever I write my HQL on parent User table such as
Code:
from User user where user.user_deleted_date_time is null
it fetches all of my user's first in a single select and then follows by a separate select statements of userTermination, obviously whenever they may only exist, although I don't need them to be fetched eagerly unless I do a left join fetch or something!
Any suggestions?
Regards
Rama