Hello all,
I'm also running into this many-to-many with relation details in the relation table. In my scenario, I have:
A<---id_A|id_B|A_B_rel_type--->B<---id_B|id_C|B_C_rel_type--->C
Code:
<set name="aBRelationships" table="A_B_REL">
<key column="ID_A"/>
<composite-element class="com.blablabla.ABRel">
<many-to-one name="b" class="com.blablabla.B">
<column name="ID_B"/>
</many-to-one>
<property name="abRelType" column="A_B_rel_type"/>
</composite-element>
</set>
Because I need to capture the rel_type data, I've had to use the composite mapping w/ many-to-one (see above), creating a Relation object for both A--->B and B--->C. However, if I need to get object A, Hibernate runs 1 + (1 * B objects mapped to A) queries, since stating "outer-join" doesn't seem to work with this methodology (as far as I can tell).
Is it possible to get the full "A" object in one query through straight configuration mapping, without resorting to straight SQL or even HQL? Any help would be appreciated...
Thanks!
Jon Aharrah
jon_aharrah@yahoo.com