Hello! I am trying to store extra data for some POJOs using a mapping, but when loading the collection only the extra field is loaded. They are mapped as follows:
<set lazy="false" name="rawMaterials" sort="natural" table="R053_TPG_RMALLOWED">
<key column="TP_GROUP_ID"/>
<many-to-many class="com.pany.rmm.jar.material.AbstractMaterial" column="RAWMATERIAL_ID" not-found="ignore" unique="false"/>
</set>
<set lazy="false" name="rawMaterialWithConstraints" table="R057_TPG_RMALLOWED_RM">
<key column="TP_GROUP_ID"/>
<composite-element class="com.pany.rmm.jar.material.RawMaterial">
<property column="RAWMATERIAL_ID" name="id"/>
<many-to-one cascade="save-update,delete" class="com.pany.rmm.jar.generic.MassConstraint" column="MASS_CONSTRAINT_ID" lazy="false" name="massConstraint" not-found="ignore"/>
</composite-element>
</set>
<set lazy="false" name="carbonMaterialWithConstraints" table="R056_TPG_RMALLOWED_CM">
<key column="TP_GROUP_ID"/>
<composite-element class="com.pany.rmm.jar.material.CarbonSourceMaterial">
<property column="RAWMATERIAL_ID" name="id"/>
<many-to-one cascade="save-update,delete" class="com.pany.rmm.jar.generic.MassConstraint" column="MASS_CONSTRAINT_ID" lazy="false" name="massConstraint" not-found="ignore"/>
</composite-element>
</set>
Fetching the rawMaterials collection works as it should:
select
rawmateria0_.TP_GROUP_ID as TP_GROUP1_4_0_,
rawmateria0_.RAWMATERIAL_ID as RAWMATER2_5_0_,
abstractma1_.RAWMATERIAL_ID as RAWMATER1_1_1_,
abstractma1_.RAWMATERIAL_NAME as RAWMATER2_1_1_,
abstractma1_.RM_GROUP_ID as RM_GROUP3_1_1_,
case
when abstractma1_1_.RAWMATERIAL_ID is not null then 1
when abstractma1_2_.RAWMATERIAL_ID is not null then 2
when abstractma1_.RAWMATERIAL_ID is not null then 0
end as clazz_1_
from
R053_TPG_RMALLOWED rawmateria0_
inner join
R022_RM_ABSTRACT abstractma1_
on rawmateria0_.RAWMATERIAL_ID=abstractma1_.RAWMATERIAL_ID
left outer join
R023_RM_SCRAP abstractma1_1_
on abstractma1_.RAWMATERIAL_ID=abstractma1_1_.RAWMATERIAL_ID
left outer join
R025_RM_CARBON abstractma1_2_
on abstractma1_.RAWMATERIAL_ID=abstractma1_2_.RAWMATERIAL_ID
where
rawmateria0_.TP_GROUP_ID=?
but for the other two collections, no data is fetched from the material tables:
select
rawmateria0_.TP_GROUP_ID as TP_GROUP1_4_0_,
rawmateria0_.RAWMATERIAL_ID as RAWMATER2_7_0_,
rawmateria0_.MASS_CONSTRAINT_ID as MASS_CON3_7_0_,
massconstr1_.MASSCONSTRAINT_ID as MASSCONS1_8_1_,
massconstr1_.MAX as MAX2_8_1_,
massconstr1_.MIN as MIN3_8_1_,
massconstr1_.VAL as VAL4_8_1_,
massconstr1_.TYPE as TYPE5_8_1_,
massconstr1_.ACTIVE as ACTIVE6_8_1_,
massconstr1_.PERCENT_BASKET_ONE as PERCENT_7_8_1_
from
R057_TPG_RMALLOWED_RM rawmateria0_
left outer join
R169_MASSCONSTRAINT massconstr1_
on rawmateria0_.MASS_CONSTRAINT_ID=massconstr1_.MASSCONSTRAINT_ID
where
rawmateria0_.TP_GROUP_ID=?
select
carbonmate0_.TP_GROUP_ID as TP_GROUP1_4_0_,
carbonmate0_.RAWMATERIAL_ID as RAWMATER2_6_0_,
carbonmate0_.MASS_CONSTRAINT_ID as MASS_CON3_6_0_,
massconstr1_.MASSCONSTRAINT_ID as MASSCONS1_8_1_,
massconstr1_.MAX as MAX2_8_1_,
massconstr1_.MIN as MIN3_8_1_,
massconstr1_.VAL as VAL4_8_1_,
massconstr1_.TYPE as TYPE5_8_1_,
massconstr1_.ACTIVE as ACTIVE6_8_1_,
massconstr1_.PERCENT_BASKET_ONE as PERCENT_7_8_1_
from
R056_TPG_RMALLOWED_CM carbonmate0_
left outer join
R169_MASSCONSTRAINT massconstr1_
on carbonmate0_.MASS_CONSTRAINT_ID=massconstr1_.MASSCONSTRAINT_ID
where
carbonmate0_.TP_GROUP_ID=?
What do I need to add to also include the material tables (R023_RM_SCRAP and R025_RM_CARBON) to the collection fetches?