This post might help a bit: http://codebetter.com/blogs/jeffrey.palermo/archive/2006/10/23/NHibernate_3A00_--Criteria-may-cause-update-_2D00_-know-about-AutoFlush-mode-_2D00_-level-300.aspx
On Sun, Oct 18, 2009 at 7:54 PM, acl123 <[email protected]> wrote: > > The following code demonstrates a misleading situation in which data > is committed to the database, even though commit is never called on a > transaction. > > Could anyone explain why? > > [TestFixture] > public class TestFixture > { > [Test] > public void Test() > { > var config = DoConfiguration(); > > using(var factory = config.BuildSessionFactory()) > { > using (var session = factory.OpenSession()) > { > CallSessionContext.Bind(session); > > using(new TransactionScope()) > { > using (session.BeginTransaction()) > { > var myEntity = session.CreateQuery > ("from myEntity").List<MyEntity>()[0]; > > myEntity.Name = "test name"; > } > > var myEntity2 = session.CreateQuery("from > myEntity").List<MyEntity>()[0]; > > myEntity2.Name = "test name"; > > session.Flush(); > } > > CallSessionContext.Unbind(factory); > } > } > } > } > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
