|
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
|