From: Andrei (JIRA) <nh...@gm...> - 2011-05-24 15:50:46
|
CLONE -Inverted parameters in HQL statement using take ------------------------------------------------------ Key: NH-2737 URL: http://216.121.112.228/browse/NH-2737 Project: NHibernate Issue Type: Bug Components: Core Affects Versions: 3.2.0CR1 Reporter: Andrei Hello, When I create a HQL query using parameters the parameters are inverted. Here is an example (I'll attach a test as soon as I have the issue number): var query = session.CreateQuery("select o.Id, i.Id from SalesOrder o left join o.Items i with i.Quantity = :p0 take :p1"); query.SetParameter("p0", 1); query.SetParameter("p1", 2); var result = query.List(); Assert.That(result.Count, Is.EqualTo(2)); The SQL Statement is: exec sp_executesql N'select TOP (@p0) salesorder0_.Id as col_0_0_, items1_.Id as col_1_0_ from SalesOrder salesorder0_ left outer join Item items1_ on salesorder0_.Id=items1_.SalesOrder and (items1_.Quantity=@p1)',N'@p0 int,@p1 int',@p0=1,@p1=2 So the query selects the top 1 rows and the quantity column is filtered with 2. Probably this bug is related with the implementation that allows to specify the take rows using parameters. Thanks, Andrei -- 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 |
From: Andrei (JIRA) <nh...@gm...> - 2011-05-24 15:52:45
|
[ http://216.121.112.228/browse/NH-2737?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andrei updated NH-2737: ----------------------- Attachment: NH2736.patch Hello Fabio, I have modified the test to use the o0 and o1 parameter names instead of the p0 and p1 reserved names and the error is the same. I've attached an update test. Thanks, Andrei > CLONE -Inverted parameters in HQL statement using take > ------------------------------------------------------ > > Key: NH-2737 > URL: http://216.121.112.228/browse/NH-2737 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 3.2.0CR1 > Reporter: Andrei > Attachments: NH2736.patch > > > Hello, > When I create a HQL query using parameters the parameters are inverted. > Here is an example (I'll attach a test as soon as I have the issue number): > var query = session.CreateQuery("select o.Id, i.Id from SalesOrder o left join o.Items i with i.Quantity = :p0 take :p1"); > query.SetParameter("p0", 1); > query.SetParameter("p1", 2); > var result = query.List(); > Assert.That(result.Count, Is.EqualTo(2)); > The SQL Statement is: > exec sp_executesql N'select TOP (@p0) salesorder0_.Id as col_0_0_, items1_.Id as col_1_0_ from SalesOrder salesorder0_ left outer join Item items1_ on salesorder0_.Id=items1_.SalesOrder and (items1_.Quantity=@p1)',N'@p0 int,@p1 int',@p0=1,@p1=2 > So the query selects the top 1 rows and the quantity column is filtered with 2. > Probably this bug is related with the implementation that allows to specify the take rows using parameters. > Thanks, > Andrei -- 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 |
From: Fabio M. (JIRA) <nh...@gm...> - 2011-05-30 17:54:42
|
[ http://216.121.112.228/browse/NH-2737?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fabio Maulo closed NH-2737. --------------------------- Resolution: Duplicate Andrei, please don't CLONE issues if not strictly necessary. This is not a place where when an issue is close for an error the user have to insist opening a clone... in fact the original issue was reopened and fixed. > CLONE -Inverted parameters in HQL statement using take > ------------------------------------------------------ > > Key: NH-2737 > URL: http://216.121.112.228/browse/NH-2737 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 3.2.0Beta2 > Reporter: Andrei > Attachments: NH2736.patch > > > Hello, > When I create a HQL query using parameters the parameters are inverted. > Here is an example (I'll attach a test as soon as I have the issue number): > var query = session.CreateQuery("select o.Id, i.Id from SalesOrder o left join o.Items i with i.Quantity = :p0 take :p1"); > query.SetParameter("p0", 1); > query.SetParameter("p1", 2); > var result = query.List(); > Assert.That(result.Count, Is.EqualTo(2)); > The SQL Statement is: > exec sp_executesql N'select TOP (@p0) salesorder0_.Id as col_0_0_, items1_.Id as col_1_0_ from SalesOrder salesorder0_ left outer join Item items1_ on salesorder0_.Id=items1_.SalesOrder and (items1_.Quantity=@p1)',N'@p0 int,@p1 int',@p0=1,@p1=2 > So the query selects the top 1 rows and the quantity column is filtered with 2. > Probably this bug is related with the implementation that allows to specify the take rows using parameters. > Thanks, > Andrei -- 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 |
From: Andrei (JIRA) <nh...@gm...> - 2011-05-30 18:11:45
|
[ http://216.121.112.228/browse/NH-2737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21231#action_21231 ] Andrei commented on NH-2737: ---------------------------- Sorry Fabio, I cloned the request before you reopened the NH-2736. I didn't know that the request can be reopened and that the messages posted on a closed request are taken in consideration. Andrei > CLONE -Inverted parameters in HQL statement using take > ------------------------------------------------------ > > Key: NH-2737 > URL: http://216.121.112.228/browse/NH-2737 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 3.2.0Beta2 > Reporter: Andrei > Attachments: NH2736.patch > > > Hello, > When I create a HQL query using parameters the parameters are inverted. > Here is an example (I'll attach a test as soon as I have the issue number): > var query = session.CreateQuery("select o.Id, i.Id from SalesOrder o left join o.Items i with i.Quantity = :p0 take :p1"); > query.SetParameter("p0", 1); > query.SetParameter("p1", 2); > var result = query.List(); > Assert.That(result.Count, Is.EqualTo(2)); > The SQL Statement is: > exec sp_executesql N'select TOP (@p0) salesorder0_.Id as col_0_0_, items1_.Id as col_1_0_ from SalesOrder salesorder0_ left outer join Item items1_ on salesorder0_.Id=items1_.SalesOrder and (items1_.Quantity=@p1)',N'@p0 int,@p1 int',@p0=1,@p1=2 > So the query selects the top 1 rows and the quantity column is filtered with 2. > Probably this bug is related with the implementation that allows to specify the take rows using parameters. > Thanks, > Andrei -- 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 |