Code:
<class name="abc.def.rules.RuleGroup" table="RULEGROUP">
<id name="ruleGroupID" column="ID">
<generator class="increment"/>
</id>
<property name="ruleGroupName" column="NAME"/>
<set name="attributes" lazy="false" cascade="none" table="RULE_GROUPS_ATTRIBUTES">
<key column="XREF_ID" not-null="true"/>
<many-to-many unique="true" column="ATTR_ID" class="abc.def.rules.Attribute"/>
</set>
<join table="OTHER_RULEGROUP_TABLE" optional="false">
<key column="ID" unique="true"/>
<!-- Various attributes-->
</join>
</class>
I have a number of questions on joining unmapped tables. I haven't yet tested this as my environment is not ready so I'm hoping somone can spot any flaws in my configuration up front.
I wish to use the RULEGROUP and OTHER_RULEGROUP_TABLE to map to an instance of a RuleGroup class.
Effectively, a row in RULEGROUP should map to a row in OTHER_RULEGROUP_TABLE one-to-one based on the ID attribute. Hence, my join above.
1. Am I interpreting the purpose of the join correctly?
Secondly, I wish to create a collection of Attributes based on the joining of these 2 tables.
However, XREF_ID exists only in the OTHER_RULEGROUP_TABLE.
2. Therefore, when it perfoms the collection creation, will it have performed the join? I'm not convinced that this will work
Please let me know if I am interpreting this join functionality incorrectly.
Thanks