These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: NHib v1.2 to v2.1.2 Configuration Error
PostPosted: Tue Aug 31, 2010 10:30 pm 
Newbie

Joined: Tue Aug 31, 2010 10:22 pm
Posts: 3
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(ReadMyFileFromAssemblyUsingReflection("MyQueries.xml"));

where ReadMyFile... is a function that gets the embedded XML from the assembly etc etc and passes it to the Configuration as a string. The xml was then added using configuration.AddXmlString(<string from xml file>)

This worked fine before in v1.2.

In V2.1.2:

The code that reads the xmls executes without error. (Of course, is not NHibernate code, it should still work the same).

After reading in the XML, the calls to Configuration.AddXmlString() also complete. Then, if I check the configuration.NamedQueries property through the debugger, gthe collection is correctly populated and 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, but of course it also eliminates my required query information.

TIA


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.