Ok.
If you are saving A and NH is savig 2 C, with cascade "all" between B->C, is
because you are doing something wrong in the code of the entity (equality
comparer) or in the code where you are saving everything. Basically NH can't
understand that the two instances of C, for you, represents the same
instance.

P.S. insert=true and update=true are defaults

2010/2/19 MiloszeS <[email protected]>

> > Probably you should change the mapping, how? we can't help you if the
> > mapping is TOP SECRET
>
> :D
>
> Sorry I've forgot about a mapping.
>
>
> <hibernate-mapping namespace="namespace" assembly="assembly"
> xmlns="urn:nhibernate-mapping-2.2">
>  <class name="B" table="b" schema="content">
> ...
> <many-to-one name="C" class="C" column="id_c" unique="true"
> lazy="false" insert="true" update="true" cascade="all" />
> ...
>
>
>
> When I removed a following part of a configuration file:
> "insert="true" update="true" cascade="all" seems to work ok. Could you
> explain me why? I'm wondering because someone puts that line for some
> reason here and I don't know whether is safe to change it or not.
>
>
> Regards,
> MiloszeS
>
> On Feb 19, 2:11 pm, Fabio Maulo <[email protected]> wrote:
> > Probably you should change the mapping, how? we can't help you if the
> > mapping is TOP SECRET
> >
> > 2010/2/19 MiloszeS <[email protected]>
> >
> >
> >
> >
> >
> > > Hi all,
> >
> > > I've got the following problem:
> >
> > >        B
> > >     /      \
> > > A             C
> > >    \        /
> > >        B
> >
> > > One object A, two B objects and one C. All of them are a new objects.
> > > After a SaveOrUpdate NHibernate inserts 1xA, 2xB and 2xC objects. What
> > > should I change to achieve a 1xA, 2xB, 1xC situation?
> >
> > > Kind regards,
> > > MiloszeS
> >
> > > --
> > > 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]>
> <nhusers%[email protected]<nhusers%[email protected]>>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/nhusers?hl=en.
> >
> > --
> > Fabio Maulo
>
> --
> 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.
>
>


-- 
Fabio Maulo

-- 
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