I am doing an eager load on a one to many relationship in hibernate. The parent items are pulled back correctly but they only recieve one item each in their child list. One of the parent's should have two. I run the query Eclipse spits out, and it pulls the correct results. Question is why would only one item go into each list when one should have two?
@OneToMany(mappedBy="badge", fetch=FetchType.EAGER)
public List<BadgeLevel> getBadgeLevels() {
return this.badgelevels;
}
SQL
select
*
from
( select
this_.ID as ID10_2_,
this_.ACTIVE as ACTIVE10_2_,
this_.DATECREATED as DATECREA3_10_2_,
this_.DATEMODIFIED as DATEMODI4_10_2_,
this_.DESCRIPTION as DESCRIPT5_10_2_,
this_.ENDDATE as ENDDATE10_2_,
this_.GLOBAL as GLOBAL10_2_,
this_.NAME as NAME10_2_,
this_.PUBLISHDETAILS as PUBLISHD9_10_2_,
this_.STARTDATE as STARTDATE10_2_,
(SELECT
COUNT(*)
FROM
BADGELEVELS bl
WHERE
bl.BADGEID = this_.ID) as formula0_2_,
badgelevel2_.BADGEID as BADGEID4_,
badgelevel2_.ID as ID4_,
badgelevel2_.ID as ID9_0_,
badgelevel2_.ACTIVE as ACTIVE9_0_,
badgelevel2_.ASSETID as ASSETID9_0_,
badgelevel2_.BADGEID as BADGEID9_0_,
badgelevel2_.DATECREATED as DATECREA3_9_0_,
badgelevel2_.DATEMODIFIED as DATEMODI4_9_0_,
badgelevel2_.DESCRIPTION as DESCRIPT5_9_0_,
badgelevel2_.FILTERS as FILTERS9_0_,
badgelevel2_."ORDER" as ORDER9_0_,
asset3_.ID as ID2_1_,
asset3_.ACTIVE as ACTIVE2_1_,
asset3_.DATECREATED as DATECREA3_2_1_,
asset3_.DATEMODIFIED as DATEMODI4_2_1_,
asset3_.DESCRIPTION as DESCRIPT5_2_1_,
asset3_.FILENAME as FILENAME2_1_,
asset3_.FILEPATH as FILEPATH2_1_,
asset3_.TITLE as TITLE2_1_,
asset3_.TYPE as TYPE2_1_
from
TEST.BADGES this_
inner join
TEST.BADGELEVELS badgelevel2_
on this_.ID=badgelevel2_.BADGEID
inner join
TEST.ASSETS asset3_
on badgelevel2_.ASSETID=asset3_.ID
where
this_.ACTIVE=1
)