Я делаю рьяную нагрузку на отношения один ко многим в спящем режиме.Родительские элементы возвращаются правильно, но они получают только один элемент каждый в своем дочернем списке.У одного из родителей должно быть два.Я запускаю запрос, который Eclipse выплевывает, и он выдает правильные результаты.Вопрос в том, почему только один элемент попадает в каждый список, если их должно быть два?
@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
)