From: Jenar (JIRA) <nh...@gm...> - 2011-05-06 08:42:59
|
Named parameter not found in HQL with mapping using "entity-name" ----------------------------------------------------------------- Key: NH-2697 URL: http://216.121.112.228/browse/NH-2697 Project: NHibernate Issue Type: Bug Components: Core Affects Versions: 3.1.0 Reporter: Jenar Priority: Critical string HQL = "update Article a set a.IsFavorite = 0 where a.IsFavorite = 1 and a.Articlegroup.Articlegroupid = :ID"; IQuery iquery = _session.CreateQuery(HQL); iquery.SetInt32("ID", articleGrp.Articlegroupid); Throws exception "System.ArgumentException: Parameter ID does not exist as a named parameter in [update Article a set a.IsFavorite = 0 where a.IsFavorite = 1 and a.Articlegroup.Articlegroupid = :ID]" if we use different mapping (through entity-name="..")for the same class ("ArticleItem") <class name="ArticleItem" ... entity-name="Article" polymorphism="explicit"> <class name="ArticleItem" ... entity-name="Article2" polymorphism="explicit"> The same code was working without problems as we had only one mapping for "ArticleItem": <class name="ArticleItem" ... polymorphism="explicit"> string HQL = "update ArticleItem a set a.IsFavorite = 0 where a.IsFavorite = 1 and a.Articlegroup.Articlegroupid = :ID"; IQuery iquery = _session.CreateQuery(HQL); iquery.SetInt32("ID", articleGrp.Articlegroupid); -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |