-->
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: Eager fetching problem
PostPosted: Thu Jan 24, 2008 7:19 am 
Newbie

Joined: Mon Dec 03, 2007 3:40 am
Posts: 5
Hi,

I have the following association:

...
<class name="Employee">
<id name="employeeId" column="employeeId">
<generator class="assigned" />
</id>
<many-to-one name="department" column="departmentId" class="Department" cascade="save-update" lazy="false" fetch="join"/>
...

Looking at the log output there are two selects instead of one using a left outer join:

select
employee0_.employeeId as employeeId1_,
employee0_.departmentId as departme2_1_,
employee0_.lastname as lastname1_,
employee0_.firstname as firstname1_,
employee0_.employeeCode as employee5_1_
from
Employee employee0_
where
departmentId=1

select
department0_.departmentId as departme1_0_0_,
department0_.departmentCode as departme2_0_0_,
department0_.name as name0_0_
from
Department department0_
where
department0_.departmentId=?

Shouldn't there only be one select statement as the fetch-attribute mandates? What is wrong here? TIA,

Kari


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 24, 2008 7:35 am 
Newbie

Joined: Tue Jan 15, 2008 10:07 am
Posts: 14
According to the reference documentation that still might depend on the way you retrieve the object. See paragraph 19.1.2.


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.