In fact, you should avoid identity fields when using NHibernate Em Seg, 17 de out de 2016 20:33, Gunnar Liljas <[email protected]> escreveu:
> A Save on a new entity with an identity POID will flush any pending > actions. Updating EntityA in Scenario2 doesn't add any pending actions > until the commit is called. In fact, you should not call Save when you're > updating. > > /G > > 2016-10-17 23:14 GMT+02:00 isern regalis <[email protected]>: > > Hi, > I'm seeing the following behavior where saving an entity with generated > identity "flushes" previous Saves on new entities but have no identity > column that haven't been commited/flushed yet, but does not do the same > when the previous uncommited Save actions are updates. I didn't find > anything documented on this. Any idea why the previous Saves (entities > having no generated identity) aren't postponed until commit like for the > update? > Thanks! > > Scenario1 (Insert): > Entity1 without identity column is saved with Save() (New so will be > inserted) > No flush or commit has yet been called so no calls to DB yet > Entity2 with identity column is saved with Save() (New so will be > inserted) > > Insert db call for Entity1 is carried out before Entity2 even though > Commit or Flush not called yet. > > Scenario2 (Update): > EntityA without identity column is saved with Save() (Existing so > will be updated) > No flush or commit has yet been called so no calls to DB yet > EntityB with identity column is saved with Save() (New so will be > inserted) > > EntityA gets updated in DB during Commit > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/nhusers. > For more options, visit https://groups.google.com/d/optout. > > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/nhusers. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/d/optout.
