From: Jenar (JIRA) <nh...@gm...> - 2011-05-10 08:17:51
|
[ http://216.121.112.228/browse/NH-2697?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jenar updated NH-2697: ---------------------- Attachment: NHibernate.Test NH-2697.zip I have prepared a Test for it. Take a look at: + Can_SetArticleFavoriteWithHQL_NamedParam() Exception param not found in HQL + Can_GetListOfArticles() no objects returned with HQL in SampleTest.cs I have attached also nh2697.fdb for testing. If Test is not perfectly made/configured sorry for that, because i am using other utils and this is my first NUnit test. Hope it will help you. > 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 > Attachments: NHibernate.Test NH-2697.zip > > > 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 |