From: Lars S. (JIRA) <nh...@gm...> - 2011-05-06 15:51:07
|
[ http://216.121.112.228/browse/NH-2697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21007#action_21007 ] Lars Schneider commented on NH-2697: ------------------------------------ I'm a collegue of jenar and just curious: Basically you are saying that it seems that our code should be working? Because all the time we where thinking that something might be wrong with the code, but we couldn't find clear examples. Most examples are much working with much simpler mapping files. If you can't reproduce the issue it would be nice if you can give us a hint what might be wrong with the mapping. Thanks in advance. > 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: Minor > > 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 |