lundi 19 octobre 2015

NHibernate unable to quary SQLite database made in different way

I have a strange issue using NHibernate to read from a SQLite database. A newer version of some software has to generate a database that is to be read from a older version of this software. The older version uses NHibernate version 3.3.3.4001 and SQLite version 1.0.89.0. The newer version does not use NHibernate and SQLite version 1.0.96.0. The database is very simple with just 4 tables and is generated using simple SQL in the new version of the software. The older version of the software can read this database without any problems, but this code that is used when deleting from the database failes:

var fluidGroup = Session.Query<FluidGroup>().SingleOrDefault(x => x.Guid == id);

It simply return null and I know there is a result. If I change the code to:

var fluidGroup = Session.Query<FluidGroup>().ToList().SingleOrDefault(x => x.Guid == id);

It works just fine. But since the software is in production changing the code is not a option. I am unable to find any differences between the databases using all pragma calls beside "page_count" and "schema_version". Changing the "schema_version"when generating the database does not help. I have also tryed to generate the database using SQLite version 1.0.89.0, but same result. How do I generate a database in SQLite where the above query works with the stated NHibernate and SQLite version?

Regards Torben

Aucun commentaire:

Enregistrer un commentaire