Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Questions on joining unmapped table
PostPosted: Wed Apr 04, 2012 4:27 pm 
Newbie

Joined: Mon Oct 20, 2008 1:50 pm
Posts: 7
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.