Hello,

I have a table, ProductStructure, with composite id:

ParentItemNumber (PINBR)
ChildItemNumber (CINBR)

The ParentItemNumber is never null.  The root Parent simply doesn't
have any record with itself as a Child.

I'd like to model a relationship such that I have:

one-to-many Parents -- psuedo query:  from ProductStructure ps where
ps.ChildItemNumber = :this_entities_parent_item_number

one-to-many Children -- psuedo query:  from ProductStructure ps where
ps.ParentItemNumber = :this_entities_child_item_number

I can't wrap my brain around how to do this.

I tried:

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-
access="">
  <class name="ProductStructure" table="PSTRUC" xmlns="urn:nhibernate-
mapping-2.2">
    <composite-id>
      <key-property type="String" name="ParentItemNumber"
column="PINBR" />
      <key-property type="String" name="ComponentItemNumber"
column="CINBR" />
    </composite-id>
    <bag name="Parents">
      <key foreign-key="PINBR" column="CINBR" />
      <one-to-many class="ProductStructure" />
    </bag>
  </class>
</hibernate-mapping>

But this won't compile so I think I'm doing this totally wrong.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to