现在的位置: 首页 > 综合 > 正文

KeyNotFoundException: 给定关键字不在字典中

2012年10月19日 ⁄ 综合 ⁄ 共 2124字 ⁄ 字号 评论关闭
NHibernate2.1.0GA,在使用过程中,出现以下错误提示:
“KeyNotFoundException: 给定关键字不在字典中。”

找问题我找了一天,是map文件中的相关的HQL使用了关键字。(“member”,这个以前是可以用的,现在不能用了。)

大家如果也有此问题,查排查你的HQL和map文件中的query的定义。

具体错误信息为:
[KeyNotFoundException: 给定关键字不在字典中。]
   System.ThrowHelper.ThrowKeyNotFoundException() +28
   System.Collections.Generic.Dictionary`2.get_Item(TKey key) +2668548
   NHibernate.Param.ParameterTranslationsImpl.GetNamedParameterInfo(String name) +32
   NHibernate.Param.ParameterTranslationsImpl.GetNamedParameterExpectedType(String name) +30
   NHibernate.Engine.Query.HQLQueryPlan.BuildParameterMetadata(IParameterTranslations parameterTranslations, String hql) +956
   NHibernate.Engine.Query.HQLQueryPlan..ctor(String hql, String collectionRole, Boolean shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor factory) +924
   NHibernate.Engine.Query.HQLQueryPlan..ctor(String hql, Boolean shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor factory) +45
   NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(String queryString, Boolean shallow, IDictionary`2 enabledFilters) +210
   NHibernate.Impl.SessionFactoryImpl.CheckNamedQueries() +449
   NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mapping, Settings settings, EventListeners listeners) +5245
   NHibernate.Cfg.Configuration.BuildSessionFactory() +137
   Spring.Data.NHibernate.LocalSessionFactoryObject.NewSessionFactory(Configuration config) +69
   Spring.Data.NHibernate.LocalSessionFactoryObject.AfterPropertiesSet() +4753
   Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.InvokeInitMethods(Object target, String name, IConfigurableObjectDefinition definition) +269
   Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.ConfigureObject(String name, RootObjectDefinition definition, IObjectWrapper wrapper) +702
   Spring.Objects.Factory.Support.WebObjectFactory.ConfigureObject(String name, RootObjectDefinition definition, IObjectWrapper wrapper) +108
   Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.InstantiateObject(String name, RootObjectDefinition definition, Object[] arguments, Boolean allowEagerCaching, Boolean suppressConfigure) +956

原贴来自:http://www.springframework.cn/blog/32.html

抱歉!评论已关闭.