From: Andrei (JIRA) <nh...@gm...> - 2011-05-24 13:04:44
|
Inverted parameters in HQL statement using take ----------------------------------------------- Key: NH-2736 URL: http://216.121.112.228/browse/NH-2736 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 13:09:47
|
[ http://216.121.112.228/browse/NH-2736?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andrei updated NH-2736: ----------------------- Attachment: NH2736.patch I've attached the test that can be integrated in the NHibernate.Test project. > Inverted parameters in HQL statement using take > ----------------------------------------------- > > Key: NH-2736 > URL: http://216.121.112.228/browse/NH-2736 > 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-24 15:12:47
|
[ http://216.121.112.228/browse/NH-2736?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fabio Maulo closed NH-2736. --------------------------- Resolution: Won't Fix You are using NH's internals parameters names. The usage of "p" followed by a number is not allowed as user-parameter-name. Those parameter-names are reserved by NHibernate. > Inverted parameters in HQL statement using take > ----------------------------------------------- > > Key: NH-2736 > URL: http://216.121.112.228/browse/NH-2736 > 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: Andrei (JIRA) <nh...@gm...> - 2011-05-24 15:25:50
|
[ http://216.121.112.228/browse/NH-2736?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21182#action_21182 ] Andrei commented on NH-2736: ---------------------------- Hi Fabio, I've replaced the parameter names with o0 and o1 and there is the same problem. If you want I can upload the modified patch. > Inverted parameters in HQL statement using take > ----------------------------------------------- > > Key: NH-2736 > URL: http://216.121.112.228/browse/NH-2736 > 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-24 16:13:44
|
[ http://216.121.112.228/browse/NH-2736?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fabio Maulo reopened NH-2736: ----------------------------- > Inverted parameters in HQL statement using take > ----------------------------------------------- > > Key: NH-2736 > URL: http://216.121.112.228/browse/NH-2736 > 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-24 16:18:50
|
[ http://216.121.112.228/browse/NH-2736?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21185#action_21185 ] Fabio Maulo commented on NH-2736: --------------------------------- Probably was introduced by another change made to the dialects... :( > Inverted parameters in HQL statement using take > ----------------------------------------------- > > Key: NH-2736 > URL: http://216.121.112.228/browse/NH-2736 > 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-24 16:25:50
|
[ http://216.121.112.228/browse/NH-2736?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21186#action_21186 ] Fabio Maulo commented on NH-2736: --------------------------------- Confirmed!! :(( > Inverted parameters in HQL statement using take > ----------------------------------------------- > > Key: NH-2736 > URL: http://216.121.112.228/browse/NH-2736 > 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-24 17:12:51
|
[ http://216.121.112.228/browse/NH-2736?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21187#action_21187 ] Fabio Maulo commented on NH-2736: --------------------------------- Ok Andrei thanks for the issue. The skip/take with parameter are already suffering some bugs due to the no-meaning Parameter way NH manage parameters all around the code. Patrick are working in another big refactoring to cut the problem at its root. I'll find a workaround just for this release. > Inverted parameters in HQL statement using take > ----------------------------------------------- > > Key: NH-2736 > URL: http://216.121.112.228/browse/NH-2736 > 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: Andrei (JIRA) <nh...@gm...> - 2011-05-24 17:53:46
|
[ http://216.121.112.228/browse/NH-2736?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andrei updated NH-2736: ----------------------- Attachment: Debug.jpg Hello, I don't know if this can help identifying the issue, but I'va noticed that the SqlString generated in the Translator of the HQLQueryPlan doesn't set the BackTrack property for the o0 parameter but it set for the o1 parameter as you can see in the attached image. I've also noticed that if I set the BackTrack property for the parameter (using the debugger window) the query executes correctly. Andrei > Inverted parameters in HQL statement using take > ----------------------------------------------- > > Key: NH-2736 > URL: http://216.121.112.228/browse/NH-2736 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 3.2.0CR1 > Reporter: Andrei > Attachments: Debug.jpg, 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 14:01:43
|
[ http://216.121.112.228/browse/NH-2736?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fabio Maulo resolved NH-2736. ----------------------------- Resolution: Fixed Fix Version/s: 3.2.0CR1 > Inverted parameters in HQL statement using take > ----------------------------------------------- > > Key: NH-2736 > URL: http://216.121.112.228/browse/NH-2736 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 3.2.0Beta2 > Reporter: Andrei > Fix For: 3.2.0Beta2 > > Attachments: Debug.jpg, 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 |