I have to map a person to a title contained in a lookup table through an 
intermediate table am having trouble with the mapping.
 
My person class has a CompositeID of PersonID and OrgID
 
My Title table has a CompositeID of OrgId, CodeMasterID, and CodeValueID
 
My intermediate table (PersonTitleCodeValue) contains PersonID,OrgId, 
CodeMasterId and CodeValueID
 
My problems is I cant fgure out a way to have a mapping between them that 
returns a single object for Title, I would even take a generic list at this 
point, which is why I tried a bag.
 
Itried the following mapping but it complained about using orgID twice and 
then complained if I removed it from either one.
 

<class name="PersonEntity" table="Person">
<composite-id>
  <key-property name="PersonID" column="person_id"/>
  <key-property name="OrgID" column-"org_id"/>
</composite-id>
<property name="FirstName" column="first_name"/>
<property name="LastName" column="last_name"/>
<bag name="Title" table="PersonTitleCodeValue" inverse="true" 
cascade="all-delete-orphan">
  <key>
    <column name="person_id">
    <column name="org_id"
  </key>
  <one-to-many>
    <column name="org_id">
    <column name="code_master_id"/>
    <column name="code_id"/>
  </one-to-many>
</bag>
</class>

<class name="OrgCodeValue" table="OrgCodeValue">
<composite-id>
  <key-property name="OrgId" column="org_id"/>
  <key-property name="CodeMasterID" column="code_master_id"/>
  <key-property name="CodeID" column="code_id"/>
</composite-id>
<property name="DisplayName" column="display_name"/>
</class>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to