Hi Mike,

Thanks for the reply! To be clear: If I abort a transaction I should
also clear the session?

Thanks,
Colin

On Jun 29, 3:48 am, Mike Nichols <nichols.mik...@gmail.com> wrote:
> You need to clear your session. Session.Clear()
>
> On Jun 28, 12:57 pm, Colin Bowern <co...@bowern.com> wrote:
>
>
>
> > While building out a few spikes to play around with NHibernate and I
> > have hit a wall with transactions under SQLite.  My configuration
> > looks like:
>
> > FluentNHibernate.Cfg.Db.SQLiteConfiguration
> >     .Standard.InMemory()
> >     .ShowSql()
> >     .Driver<NHibernate.Driver.SQLite20Driver>()
> >     .Provider<NHibernate.Connection.DriverConnectionProvider>()
> >     .ProxyFactoryFactory
> > ("NHibernate.ByteCode.Castle.ProxyFactoryFactory,
> > NHibernate.ByteCode.Castle")
> >     .Raw("connection.release_mode", "on_close");
>
> > My test explicitly calls a rollback:
>
> > NHibernate.ISession session = SessionManager.GetCurrentSession();
> > using (NHibernate.ITransaction transaction = session.BeginTransaction
> > ())
> > {
>
> >     id = (int)session.Save(new Foo { Name = "Sam" });
> >     id = (int)session.Save(new Foo { Name = "Sam" });
> >     transaction.Rollback();
>
> > }
>
> > var result = session.Get<Foo>(id.Value);
> > Assert.IsNull(result);
>
> > Yet it does not seem to rollback.  Does SQLite have support for
> > transactions?  In the ShowSQL I am not seeing any evidence of it:
>
> > == Creating Test Schema
> > id
> > property
> > id
> > property
> > drop table if exists Foo
> > create table Foo (Id  integer, Name TEXT, primary key (Id))
> > == Inserting Test Data
> > NHibernate: INSERT INTO Foo (Name) VALUES (@p0); select
> > last_insert_rowid(); @p0 = 'Tom'
> > NHibernate: INSERT INTO Foo (Name) VALUES (@p0); select
> > last_insert_rowid(); @p0 = 'Dick'
> > NHibernate: INSERT INTO Foo (Name) VALUES (@p0); select
> > last_insert_rowid(); @p0 = 'Harry'
> > == Initialization Complete
> > NHibernate: INSERT INTO Foo (Name) VALUES (@p0); select
> > last_insert_rowid(); @p0 = 'Sam'
> > NHibernate: INSERT INTO Foo (Name) VALUES (@p0); select
> > last_insert_rowid(); @p0 = 'Sam'
>
> > Thanks,
> > Colin- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to nhusers@googlegroups.com
To unsubscribe from this group, send email to 
nhusers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to