Well my problem isn't the first time I'm saving my objectgraph, its
the second time when I sending my object graph received from the
clients db to the WCF service which saves it again, and then the id's
are already set, I suppose I need to iterate through each of my childs
and save them one by one.

On 2 Juni, 15:06, Fabio Maulo <[email protected]> wrote:
> Are you assign the ID by yourself in the class ?If yes, that is the problem.
> Remove all assign of ID and let NH do that work.
>
> The property for the ID should look like
> public Guid Id{get{return _id;}}
>
> 2009/6/2 Niclas Pehrsson <[email protected]>
>
>
>
>
>
> > Of course I should post my mappings to, sorry
>
> >  <class name="Receipt">
> >    <id name="ClientId" access="field.camelcase-underscore"
> > type="System.Guid" unsaved-
> > value="00000000-0000-0000-0000-000000000000">
> >      <generator class="guid" />
> >    </id>
>
> >    <set name="Entries" access="field.camelcase-underscore"
> > inverse="true" cascade="all-delete-orphan">
> >      <key column="ReceiptId" foreign-key="FK_Receipt_ReceiptEntry" on-
> > delete="cascade"/>
> >      <one-to-many class="Hogia.CashRegister.ReceiptEntry,
> > Hogia.CashRegister"/>
> >    </set>
> > </class>
>
> >  <class name="ReceiptEntry">
> >    <id name="ClientId" access="field.camelcase-underscore"
> > type="System.Guid" unsaved-
> > value="00000000-0000-0000-0000-000000000000">
> >      <generator class="guid" />
> >    </id>
>
> >    <many-to-one name="_parent" access="field" class="Receipt"
> > column="ReceiptId" not-null="true"/>
> > </class>
>
> > On 1 Juni, 16:38, Fabio Maulo <[email protected]> wrote:
> > > which POID generation strategy are you using ?How look the mapping ?
>
> > > 2009/6/1 Niclas Pehrsson <[email protected]>
>
> > > > Hi I'm building a distributed system, the client has one database
> > > > which needs to be synchronized and some modifications to a master
> > > > server with WCF services.
>
> > > > The persisting of the object in the client goes smoothly no worries
> > > > here.
>
> > > > But when I uses
>
> > > > session.Save(receipt) on the server-side, it only marks the top of the
> > > > objectgraph as save not its children
> > > > it would result in that I only gets my receipt save and not receipt
> > > > entries.
>
> > > > I have choosen to let receiptentry to control the insertion because I
> > > > don't want to let the ReceiptId in the ReceiptEntry table to be null
> > > > at any time.
>
> > > > It seems like NHibernate believes that the RecetiptEntries already has
> > > > been saved cause they already been given an Id. How can I mark the
> > > > whole receipt object graph to be inserted event with already assigned
> > > > ID's and not only the top?
>
> > > > Do I need to first save my receipt and then iterate through its
> > > > children and save them one by one?
> > > > Or is there something else smoother I can do?
>
> > > --
> > > Fabio Maulo
>
> --
> 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