Well this does not solve my problem.
<class name="HierarchyItem">
<composite-id >
<key-many-to-one name="Hierarchy" column="HierarchyId"/>
<key-property name="ItemId" column="ItemId"/>
</composite-id>
<many-to-one name="ParentItem" class="HierarchyItem">
<column name="HierarchyId" />
<column name="ParentItemId" />
</many-to-one>
</class>
I still have column HierarchyId specified twice.
It would be great to have something like <column-many-to-one> or <column
insert="false" update="false/> instead of <column name="HierarchyId" />.
Peter
On Tue, Jan 19, 2010 at 1:34 PM, Gigi <[email protected]> wrote:
> I think you should use <key-many-to-one /> in the <id/> and remove the
> <many-to-one name="Hierarchy" ... />
> Then you will access Hierarchy through the Id.
>
> On 19 Gen, 10:28, Petr Syromolotov <[email protected]> wrote:
> > Hello
> >
> > I have following mapping:
> >
> > <class name="HierarchyItem">
> > <composite-id >
> > <key-property name="Hierarchy" column="HierarchyId"/>
> > <key-property name="ItemId" column="ItemId"/>
> > </composite-id>
> >
> > <many-to-one name="Hierarchy" column="HierarchyId" insert="false"
> > update="false"></many-to-one>
> >
> > <many-to-one name="ParentItem" class="HierarchyItem">
> > <column name="HierarchyId" />
> > <column name="ParentItemId" />
> > </many-to-one>
> > </class>
> >
> > The problem is that this mapping does not work - it generates
> > "IndexOutOfRangeException" because columns "HierarchyId" is specified
> twice.
> > I can not put insert="false" update="false" to second <many-to-one> tag.
> > Is there any way to specify these options (insert="false" update="false")
> > only for <column name="HierarchyId" /> but not to entire
> <many-to-one>
> > tag?
> >
> > PS I know that DB design is not good here but I can't do anything with
> this.
>
> --
> 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.
