sheesh I'm really not making any sense with this post.
For lack of proper vocabulary to describe my problem this is the best way I can explain it:
currently, I have a few custom loaders for loading collections.
<set name="chargeImpacts" inverse="true">
<key>
<column name="LTB_DISTRICT_CD" />
<column name="TITLE_NMBR" />
</key>
<one-to-many class="ca.ltsa.srs.database.entity.ChargeImpact" />
<loader query-ref="loadChargeImpacts" />
</set>
...
<sql-query name="loadChargeImpacts">
<load-collection alias="chimp" role="ca.ltsa.srs.database.entity.Title.chargeImpacts"></load-collection>
<return-join alias="charge" property="chimp.charge"></return-join>
<return-join alias="chrgdoc" property="charge.dcmnt"></return-join>
<return-join alias="rlsdoc" property="chimp.releasedByDcmnt"></return-join>
select
{chimp.*}, {charge.*}, {chrgdoc.*}, {rlsdoc.*}
from VCHIMP as chimp
inner join VCHARG as charge
on chimp.DCMNT_DISTRICT_CD=charge.DCMNT_DISTRICT_CD
and chimp.CHARGE_NMBR=charge.CHARGE_NMBR
inner join VDCMNT as chrgdoc
on charge.DCMNT_MSTR_NMBR=chrgdoc.DCMNT_MSTR_NMBR
and charge.DCMNT_DISTRICT_CD=chrgdoc.DCMNT_DISTRICT_CD
left outer join VDCMNT as rlsdoc
on chimp.RLS_DCMNT_MSTR_NO=rlsdoc.DCMNT_MSTR_NMBR
and chimp.RLS_DCMNT_DIST_CD=rlsdoc.DCMNT_DISTRICT_CD
where
chimp.LTB_DISTRICT_CD=?
and chimp.TITLE_NMBR=?
</sql-query>
I need to do the same thing for a simple many-to-one association instead of for a collection! This is driving me crazy :(
|