tags:

views:

22

answers:

0

I am trying to migrate a V1.2 app to V2.1.2. Previously I could save my HQL queries in embedded XML files then load them like this:

configuration.AddXmlString(ReadMyFileFromResourceUsingReflection("MyQueries.xml"));

where ReadMyFile... is a function that gets the embedded XML from the assembly etc etc.

This worked fine before. In V2.1.2:

The code executes without error and the streams are read correctly. (Of course, this is not NHibernate code, it should still work the same).

After reading in the XML, checking the configuration.NamedQueries property through the debugger indicates the XML was in fact loaded as named queries.

But an exception is thrown as soon as I try to get the factory:

Object reference not set to an instance of an object. at NHibernate.Engine.Query.QueryPlanCache.HQLQueryPlanKey..ctor(String query, Boolean shallow, IDictionary2 enabledFilters) at NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(String queryString, Boolean shallow, IDictionary2 enabledFilters) at NHibernate.Impl.SessionFactoryImpl.CheckNamedQueries() at NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mapping, Settings settings, EventListeners listeners) at NHibernate.Cfg.Configuration.BuildSessionFactory() at Car.Emr.RepositoryTests.TestSession

Removing the section where the queries are read in eliminates the above error.