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