No promises, but here's my guess: NHibernate isn't able to detect the two entities are the same, so treats the results of the two gets as separate entities (not what you want) -and when you commit, entity #2 is getting things changed out from under it-by the save of entity #1. You want NHibernate to realize these two gets are really getting the same thing, so you can avoid this problem. I'd bet you haven't implemented Equals on this entity, or your Equals method may not be right.
Hope thishelps... On Sun, Mar 21, 2010 at 5:51 PM, Jomimota <[email protected]> wrote: > Hello, > > I'm here with a doubt about a procedure with regard to and doesn't have > this problemTransactions > use, when we perform a Session.Get. > According to a post I read of Ayende Rahien, we must use Transactions > allways including in Session.Get. It happens that I have a situation > at hand that I eventually have to pick twice the same entity data, > during the same Session. Of course, if I don't > use Transactions everything goes fine and I can retrieve the entity > data, but if I use, when I commit the second Session.Get of the same > data, the NHibernate gives the following error: > > "Row was updated or deleted by another transaction (or unsaved-value > mapping was incorrect) " > > I've tried all IsolationLevel available with same results, and have > the Locking Session.Get placed to LockMode.NONE. > > The error message makes no sense (at least for me) since there was no > update or delete, before or between Session.Get's, and if there a > mapping error that should have arisen in the first Session.Get. > > Is this a Bug? > I can't use Tansactions in this conditions? > > Tia, > > Jorge Mota > > -- > 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.
