Merge 2009/4/6 graphicsxp <[email protected]>
> > If I use Update(), NH does a UPDATE query (regardless my entity was > modified or not) but doesn't persist or delete the items in the > collection... > > > On 6 avr, 17:28, Fabio Maulo <[email protected]> wrote: > > The method to reattach the entity to a new session is wrong.You should > use > > Update or Merge. > > > > 2009/4/6 graphicsxp <[email protected]> > > > > > > > > > > > > > Hello, > > > > > I still don't get it. Roger you gave me a link to hibernate doc, but > > > this is nhibernate and I can't find any references to .Merge() in the > > > nhibernate doc. > > > > > Here's what I do and what I need ; > > > > > Open Session > > > Get entity > > > Close Session > > > Send entity to client > > > Client modifies entity > > > Client sends entity to server > > > Open Session > > > Save entity --> here's the issue because the update is made whether > > > the entity was changed or not by the client > > > Close Session > > > > > another issue I've just noticed is that if my entity Post holds a > > > collection of Comments, if I delete some of the comments, when I do > > > myPost.Save(), nothing gets deleted. (I've specified cascade = "all- > > > delete-orphan") > > > > > Can you help with this ? > > > > > On 3 avr, 15:12, Roger Kratz <[email protected]> wrote: > > > >http://www.dil.univ-mrs.fr/~massat/docs/hibernate-3.1/api/org/hiberna > .. > > > .) > > > > > > -----Original Message----- > > > > From: [email protected] [mailto:[email protected]] On > > > Behalf Of graphicsxp > > > > Sent: den 3 april 2009 16:09 > > > > To: nhusers > > > > Subject: [nhusers] Re: how to detect changes to entities > > > > > > SaveOrUpdate triggers an UPDATE regardless the entity has changed or > > > > not. I'm not sure about session.Merge. > > > > > > On 3 avr, 15:00, Gustavo Ringel <[email protected]> wrote: > > > > > session.SaveOrUpdate or session.Merge should be enough for this > case... > > > > > I really don't think that sending domain object through the wire is > a > > > good > > > > > practice. But it works for small apps. > > > > > > > Gustavo. > > > > > > > On Fri, Apr 3, 2009 at 4:23 PM, graphicsxp < > [email protected] > > > >wrote: > > > > > > > > Hi, > > > > > > > > Normally NH is able to detect any changes made to entities and > > > > > > when .save() is called, the UPDATE will be made only if the > entity > > > was > > > > > > changed. > > > > > > > > Now the issue is that I'm sending my entities across the wire > from > > > the > > > > > > server to the client (via WCF), the client modifies the entity > (or > > > > > > not), clicks on a save button and the entity is sent back to the > > > > > > server. How can NH detects the entity has changed since it does > not > > > > > > belong to the same session ? > > > > > > > > Thanks > > > > -- > > 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 -~----------~----~----~----~------~----~------~--~---
