|
This is not necessarily a NHibernate problem per se, as the exception is being generated from the lower-level SQLite ADO data provider. I'm hoping, however, that perhaps other people have experienced this problem before, or will know how to solve it. I have cross-posted this to the System.Data.SQLite forum and will post summary of results.
The context is this:
- I have a very large collection of images that I want to parse and store its parameters and characteristics in a database. Images are related to each other through a specific tree-like hierarchy.
- As I process the images, I will query the database to see whether the image and its hierarchy already exists in the database. I will then store the image parameters temporarily in memory. After processing a certain number of images, I will decide to store the in-memory collection of parameters to the database, and free up some memory. The storage (could be a combination of inserts and/or updates) is successful.
- Upon the very next select statement that is executed, the exception is thrown. The exception is, "Cannot execute query," and the inner exception from System.Data.SQLite is "Transaction is not associated with the command's connection."
Other notes:
- An exception is also thrown when I use the Finisar SQLite data provider, though its exception is different of course: "The connection must be open to call ExecuteReader".
- An exception is NOT thrown when I run the same code using Microsoft SQL Server 2005 using the Microsoft data providers
Hibernate version: 1.0.2
Full stack trace of any exception that occurs:
See bottom of post.
Name and version of the database you are using:
SQLite3, System.Data.SQLite v1.0.33.0 driver for ADO.NET 2.0
The generated SQL (show_sql=true):
select count(study0_.StudyOid_) as x0_0_ from Study_ study0_ where (study0_.StudyInstanceUid_=@p0)
Debug level Hibernate log excerpt:
2006-08-25 12:07:26,437 [5264] INFO NHibernate.Loader.Loader - select count(study0_.StudyOid_) as x0_0_ from Study_ study0_ where (study0_.StudyInstanceUid_=@p0)
2006-08-25 12:07:26,437 [5264] WARN NHibernate.Util.ADOExceptionReporter - System.ArgumentException: Transaction is not associated with the command's connection
at System.Data.SQLite.SQLiteCommand.set_Transaction(SQLiteTransaction value)
at System.Data.SQLite.SQLiteCommand.set_DbTransaction(DbTransaction value)
at System.Data.Common.DbCommand.System.Data.IDbCommand.set_Transaction(IDbTransaction value)
at NHibernate.Transaction.AdoTransaction.Enlist(IDbCommand command)
at NHibernate.Impl.BatcherImpl.Prepare(IDbCommand command)
at NHibernate.Impl.BatcherImpl.ExecuteReader(IDbCommand cmd)
at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, RowSelection selection, ISessionImplementor session)
2006-08-25 12:07:26,453 [5264] ERROR NHibernate.Util.ADOExceptionReporter - Transaction is not associated with the command's connection
2006-08-25 12:07:26,453 [5264] WARN NHibernate.Util.ADOExceptionReporter - System.ArgumentException: Transaction is not associated with the command's connection
at System.Data.SQLite.SQLiteCommand.set_Transaction(SQLiteTransaction value)
at System.Data.SQLite.SQLiteCommand.set_DbTransaction(DbTransaction value)
at System.Data.Common.DbCommand.System.Data.IDbCommand.set_Transaction(IDbTransaction value)
at NHibernate.Transaction.AdoTransaction.Enlist(IDbCommand command)
at NHibernate.Impl.BatcherImpl.Prepare(IDbCommand command)
at NHibernate.Impl.BatcherImpl.ExecuteReader(IDbCommand cmd)
at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, RowSelection selection, ISessionImplementor session)
at NHibernate.Hql.QueryTranslator.GetEnumerable(QueryParameters parameters, ISessionImplementor session)
at NHibernate.Impl.SessionImpl.Enumerable(String query, QueryParameters parameters)
2006-08-25 12:07:26,453 [5264] ERROR NHibernate.Util.ADOExceptionReporter - Transaction is not associated with the command's connection
|