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\DriverConnectionProvider.cs:
line 49
at
NHibernate.Tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.Prepare()
in
s:\OpenSource\NHibernate\nhibernate\src\NHibernate\Tool\hbm2ddl\SuppliedConnectionProviderConnectionHelper.cs:
line 25
at
NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.GetReservedWords(Dialect
dialect, IConnectionHelper connectionHelper) in
s:\OpenSource\NHibernate\nhibernate\src\NHibernate\Tool\hbm2ddl\SchemaMetadataUpdater.cs:
line 43
at
NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.Update(ISessionFactory
sessionFactory) in
s:\OpenSource\NHibernate\nhibernate\src\NHibernate\Tool\hbm2ddl\SchemaMetadataUpdater.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\FluentConfiguration.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.