Note: This is an application that was running 3.1 before, and I
recently updated it to the trunk version of 3.2

It definitely didn't work out of the box any more. I had to completely
comment out the Connection_StateChange event, and rebuild NH to get my
application to run.

It's the same SQLite version (1.0.66.00) as before, I believe it's
caused by some recent change in NHibernate and the way I'm creating
the SessionFactory in this particular project.

When I have more time I'll dig some more, but based on the code I
pasted in the first post, I think I have described what the code path
to that exception is, and it seems possible to get in that state.

I'm also using a custom built version of Fluent NHibernate, which I
updated to work with 3.2, so I'm not sure if this is somehow related
to it. The SessionFactory is created via Fluent NHibernate.


On May 23, 7:08 pm, Patrick Earl <[email protected]> wrote:
> Which version of System.Data.SQLite is this?  Perhaps it's a recent
> change?
>
>           Patrick Earl
>
> On May 22, 3:38 pm, Andrei Alecu <[email protected]> wrote:
>
>
>
>
>
>
>
> > I can't seem to use SQLite any more with NHibernate 3.2. I get the
> > following exception:
>
> > SetUp : FluentNHibernate.Cfg.FluentConfigurationException : An invalid
> > or incomplete configuration was used while creating a SessionFactory.
> > Check PotentialReasons collection, and InnerException for more detail.
>
> >    ----> System.Data.SQLite.SQLiteException : Callback routine requested
> > an abort
> > Execution was aborted by the user
>
> > --SQLiteException
> > at System.Data.SQLite.SQLiteDataReader.CheckClosed()
> > at System.Data.SQLite.SQLiteDataReader.NextResult()
> > at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
> > at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery()
> > at NHibernate.Driver.SQLite20Driver.Connection_StateChange(Object
> > sender, StateChangeEventArgs e) in
> > s:\OpenSource\NHibernate\nhibernate\src\NHibernate\Driver\SQLite20Driver.cs 
> > :
> > line 55
> > at System.Data.SQLite.SQLiteConnection.Open()
> > at NHibernate.Connection.DriverConnectionProvider.GetConnection() in
> > s:\OpenSource\NHibernate\nhibernate\src\NHibernate\Connection\DriverConnect 
> > ionProvider.cs:
> > line 49
> > at
> > NHibernate.Tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.Prepare( 
> > )
> > in
> > s:\OpenSource\NHibernate\nhibernate\src\NHibernate\Tool\hbm2ddl\SuppliedCon 
> > nectionProviderConnectionHelper.cs:
> > line 25
> > at
> > NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.GetReservedWords(Dialect
> > dialect, IConnectionHelper connectionHelper) in
> > s:\OpenSource\NHibernate\nhibernate\src\NHibernate\Tool\hbm2ddl\SchemaMetad 
> > ataUpdater.cs:
> > line 43
> > at NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.Update(ISessionFactory
> > sessionFactory) in
> > s:\OpenSource\NHibernate\nhibernate\src\NHibernate\Tool\hbm2ddl\SchemaMetad 
> > ataUpdater.cs:
> > line 17
> > at NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping
> > mapping, Settings settings, EventListeners listeners) in
> > s:\OpenSource\NHibernate\nhibernate\src\NHibernate\Impl\SessionFactoryImpl. 
> > cs:
> > line 172
> > at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() in
> > S:\OpenSource\fluent-nhibernate\src\FluentNHibernate\Cfg\FluentConfiguratio 
> > n.cs:
> > line 108
>
> > The code in NHibernate.Driver.SQLite20Driver.Connection_StateChange
> > wants to ExecuteNonQuery, but in CheckClosed(), SQLite.NET does this:
>
> >   private void CheckClosed()
> >      {
> >        if (_command == null)
> >          throw new InvalidOperationException("DataReader has been closed");
>
> >     *    if (_version == 0)
> >          throw new SQLiteException((int)SQLiteErrorCode.Abort, "Execution 
> > was aborted by the user");*
>
> >        if (_command.Connection.State != ConnectionState.Open || 
> > _command.Connection._version != _version)
> >          throw new InvalidOperationException("Connection was closed, 
> > statement was terminated");
> >      }
>
> > I dug through the SQLite.NET source and I see the following code:
>
> > OnStateChange(ConnectionState.Open);
> > _version++;
>
> > So, version starts at 0 and is only incremented after OnStateChange, which 
> > is what Connection_StateChange is subscribed to.
>
> > Am I doing something wrong or is this a bug?
>
> > Is someone else able to use SQLite with NH 3.2? Unless anyone else got it 
> > to work, I can submit a JIRA issue.

-- 
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.

Reply via email to