Sorry I made a couple of typos, try the following (changing table and
column names to match your model):
<class name="Parent" Table="Parent">
<composite-id>
<key-property name="key1" column="Key1" />
<key-property name="key2" column="Key2" />
</composite-id>
<set name="Child" class="Child">
<key>
<!-- following columns are on the child class -->
<column name="key1" />
<column name="key2" />
</key>
</set>
</class>
<class name="Child" Table="Child">
<composite-id>
<key-property name="key1" column="Key1" />
<key-property name="key2" column="Key2" />
<key-property name="key3" column="Key3" />
</composite-id>
<many-to-one name="Parent" class="Parent">
<!-- following columns are on this class -->
<column name="key1" ... />
<column name="key2" ... />
</many-to-one>
</class>
And yes, when you see <column name="something" /> something is the
actually column name in the db
On Feb 4, 3:40 pm, Ying Guo <[email protected]> wrote:
> thanks for the reply, however I do try this. And it does not seem to work
> for me.
> Won't through any exception however the collection is empty.
>
> For single key column seems working fine.
>
> so for this
> <column name="key1" />
> <column name="key2" />
> should these be database column name?
>
> On Fri, Feb 4, 2011 at 1:53 PM, Tim Hoolihan - @thoolihan <
>
>
>
>
>
>
>
> [email protected]> wrote:
>
> > On Feb 3, 11:42 pm, YingGuo <[email protected]> wrote:
> > > Parent class has composite key
>
> > > (key1,key2,fieldx,fieldy...)
>
> > > child class has composite key
> > > (key1,key2,key3,fielda,....)
>
> > You didn't post a lot of detail, but here's a stab in the dark...
>
> > <class name="Parent" ... >
> > <composite-id>
> > <key property="key1" ... />
> > <key property="key2" ... />
> > </composite-id>
> > <set name="Child" class="Child">
> > <key>
> > <!-- following columns are on the child class -->
> > <column name="key1" />
> > <column name="key2" />
> > </key>
> > </set>
> > </class>
>
> > <class name="Child" ... >
> > <composite-id>
> > <key property="key1" ... />
> > <key property="key2" ... />
> > <key property="key3" ... />
> > </composite-id>
> > <many-to-one name="Parent" class="Parent">
> > <key property="key1" ... />
> > <key property="key2" ... />
> > </many-to-one>
> > </class>
>
> > --
> > 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]<nhusers%[email protected]
> > >
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.
--
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.