|
From: Brian B. (JIRA) <nh...@gm...> - 2010-11-17 08:06:35
|
HQL parameters not converted correctly to SQL
---------------------------------------------
Key: NH-2415
URL: http://216.121.112.228/browse/NH-2415
Project: NHibernate
Issue Type: Bug
Components: Core
Affects Versions: 3.0.0.Beta2, 2.1.2.GA
Reporter: Brian Berns
Priority: Major
Parameters added to an HQL query are jumbled in the resulting SQL. I have created a simple test case that demonstrates this problem using the BasicClassFixture:
[Test]
public void TestHQL()
{
var bc = InsertBasicClass(1);
using (var session = OpenSession())
using (var trans = session.BeginTransaction())
{
var hql = "from BasicClass bc where (bc.StringProperty = :prop) and (bc.StringMap[:key] = :value)";
bc = session.CreateQuery(hql)
.SetParameter("prop", "string property")
.SetParameter("key", "keyZero")
.SetParameter("value", "string zero")
.UniqueResult<BasicClass>();
Assert.NotNull(bc);
session.Delete(bc);
trans.Commit();
}
}
The generated SQL is:
exec sp_executesql N'select basicclass0_.id as id16_, basicclass0_.char_p as char2_16_, basicclass0_.class_p as class3_16_, basicclass0_.cinfo_p as cinfo4_16_, basicclass0_.dtm_p as dtm5_16_, basicclass0_.shrt_p as shrt6_16_, basicclass0_.int_p as int7_16_, basicclass0_.lng_p as lng8_16_, basicclass0_.flt_p as flt9_16_, basicclass0_.str_p as str10_16_, basicclass0_.ticks_p as ticks11_16_, basicclass0_.tf_p as tf12_16_, basicclass0_.yn_p as yn13_16_, basicclass0_.priv_fld as priv14_16_ from bc basicclass0_, bc_stmap stringmap1_ where basicclass0_.id=stringmap1_.bc_id and stringmap1_.strm_idx = @p0 and basicclass0_.str_p=@p1 and stringmap1_.str_val=@p2',N'@p0 nvarchar(4000),@p1 nvarchar(10),@p2 nvarchar(4000)',@p0=N'string property',@p1=N'keyZero',@p2=N'string zero'
This query returns no rows when it should return exactly one. This is because @p0 and @p1 have been swapped.
--
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: Julian M. (JIRA) <nh...@gm...> - 2010-12-15 09:24:07
|
[ http://216.121.112.228/browse/NH-2415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20291#action_20291 ]
Julian Maughan commented on NH-2415:
------------------------------------
I have verified the problem. Do you know if this worked in a previous version?
> HQL parameters not converted correctly to SQL
> ---------------------------------------------
>
> Key: NH-2415
> URL: http://216.121.112.228/browse/NH-2415
> Project: NHibernate
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.1.2.GA, 3.0.0.Beta2
> Reporter: Brian Berns
> Priority: Major
>
> Parameters added to an HQL query are jumbled in the resulting SQL. I have created a simple test case that demonstrates this problem using the BasicClassFixture:
> [Test]
> public void TestHQL()
> {
> var bc = InsertBasicClass(1);
> using (var session = OpenSession())
> using (var trans = session.BeginTransaction())
> {
> var hql = "from BasicClass bc where (bc.StringProperty = :prop) and (bc.StringMap[:key] = :value)";
> bc = session.CreateQuery(hql)
> .SetParameter("prop", "string property")
> .SetParameter("key", "keyZero")
> .SetParameter("value", "string zero")
> .UniqueResult<BasicClass>();
> Assert.NotNull(bc);
> session.Delete(bc);
> trans.Commit();
> }
> }
> The generated SQL is:
> exec sp_executesql N'select basicclass0_.id as id16_, basicclass0_.char_p as char2_16_, basicclass0_.class_p as class3_16_, basicclass0_.cinfo_p as cinfo4_16_, basicclass0_.dtm_p as dtm5_16_, basicclass0_.shrt_p as shrt6_16_, basicclass0_.int_p as int7_16_, basicclass0_.lng_p as lng8_16_, basicclass0_.flt_p as flt9_16_, basicclass0_.str_p as str10_16_, basicclass0_.ticks_p as ticks11_16_, basicclass0_.tf_p as tf12_16_, basicclass0_.yn_p as yn13_16_, basicclass0_.priv_fld as priv14_16_ from bc basicclass0_, bc_stmap stringmap1_ where basicclass0_.id=stringmap1_.bc_id and stringmap1_.strm_idx = @p0 and basicclass0_.str_p=@p1 and stringmap1_.str_val=@p2',N'@p0 nvarchar(4000),@p1 nvarchar(10),@p2 nvarchar(4000)',@p0=N'string property',@p1=N'keyZero',@p2=N'string zero'
> This query returns no rows when it should return exactly one. This is because @p0 and @p1 have been swapped.
--
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: Brian B. (JIRA) <nh...@gm...> - 2010-12-15 17:17:14
|
[ http://216.121.112.228/browse/NH-2415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20294#action_20294 ]
Brian Berns commented on NH-2415:
---------------------------------
Sorry, I do not know if this used to work.
> HQL parameters not converted correctly to SQL
> ---------------------------------------------
>
> Key: NH-2415
> URL: http://216.121.112.228/browse/NH-2415
> Project: NHibernate
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.1.2.GA, 3.0.0.Beta2
> Reporter: Brian Berns
> Priority: Major
>
> Parameters added to an HQL query are jumbled in the resulting SQL. I have created a simple test case that demonstrates this problem using the BasicClassFixture:
> [Test]
> public void TestHQL()
> {
> var bc = InsertBasicClass(1);
> using (var session = OpenSession())
> using (var trans = session.BeginTransaction())
> {
> var hql = "from BasicClass bc where (bc.StringProperty = :prop) and (bc.StringMap[:key] = :value)";
> bc = session.CreateQuery(hql)
> .SetParameter("prop", "string property")
> .SetParameter("key", "keyZero")
> .SetParameter("value", "string zero")
> .UniqueResult<BasicClass>();
> Assert.NotNull(bc);
> session.Delete(bc);
> trans.Commit();
> }
> }
> The generated SQL is:
> exec sp_executesql N'select basicclass0_.id as id16_, basicclass0_.char_p as char2_16_, basicclass0_.class_p as class3_16_, basicclass0_.cinfo_p as cinfo4_16_, basicclass0_.dtm_p as dtm5_16_, basicclass0_.shrt_p as shrt6_16_, basicclass0_.int_p as int7_16_, basicclass0_.lng_p as lng8_16_, basicclass0_.flt_p as flt9_16_, basicclass0_.str_p as str10_16_, basicclass0_.ticks_p as ticks11_16_, basicclass0_.tf_p as tf12_16_, basicclass0_.yn_p as yn13_16_, basicclass0_.priv_fld as priv14_16_ from bc basicclass0_, bc_stmap stringmap1_ where basicclass0_.id=stringmap1_.bc_id and stringmap1_.strm_idx = @p0 and basicclass0_.str_p=@p1 and stringmap1_.str_val=@p2',N'@p0 nvarchar(4000),@p1 nvarchar(10),@p2 nvarchar(4000)',@p0=N'string property',@p1=N'keyZero',@p2=N'string zero'
> This query returns no rows when it should return exactly one. This is because @p0 and @p1 have been swapped.
--
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: Brian B. (JIRA) <nh...@gm...> - 2011-02-08 01:27:49
|
[ http://216.121.112.228/browse/NH-2415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20553#action_20553 ]
Brian Berns commented on NH-2415:
---------------------------------
It's been several months since I reported this bug. It seems like a pretty major problem to me - it makes it impossible to use parameters in my application. Are there any plans to fix it? I'd even be willing to take a shot at it myself if someone could point me in the right direction.
> HQL parameters not converted correctly to SQL
> ---------------------------------------------
>
> Key: NH-2415
> URL: http://216.121.112.228/browse/NH-2415
> Project: NHibernate
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.1.2.GA, 3.0.0.Beta2
> Reporter: Brian Berns
> Priority: Major
>
> Parameters added to an HQL query are jumbled in the resulting SQL. I have created a simple test case that demonstrates this problem using the BasicClassFixture:
> [Test]
> public void TestHQL()
> {
> var bc = InsertBasicClass(1);
> using (var session = OpenSession())
> using (var trans = session.BeginTransaction())
> {
> var hql = "from BasicClass bc where (bc.StringProperty = :prop) and (bc.StringMap[:key] = :value)";
> bc = session.CreateQuery(hql)
> .SetParameter("prop", "string property")
> .SetParameter("key", "keyZero")
> .SetParameter("value", "string zero")
> .UniqueResult<BasicClass>();
> Assert.NotNull(bc);
> session.Delete(bc);
> trans.Commit();
> }
> }
> The generated SQL is:
> exec sp_executesql N'select basicclass0_.id as id16_, basicclass0_.char_p as char2_16_, basicclass0_.class_p as class3_16_, basicclass0_.cinfo_p as cinfo4_16_, basicclass0_.dtm_p as dtm5_16_, basicclass0_.shrt_p as shrt6_16_, basicclass0_.int_p as int7_16_, basicclass0_.lng_p as lng8_16_, basicclass0_.flt_p as flt9_16_, basicclass0_.str_p as str10_16_, basicclass0_.ticks_p as ticks11_16_, basicclass0_.tf_p as tf12_16_, basicclass0_.yn_p as yn13_16_, basicclass0_.priv_fld as priv14_16_ from bc basicclass0_, bc_stmap stringmap1_ where basicclass0_.id=stringmap1_.bc_id and stringmap1_.strm_idx = @p0 and basicclass0_.str_p=@p1 and stringmap1_.str_val=@p2',N'@p0 nvarchar(4000),@p1 nvarchar(10),@p2 nvarchar(4000)',@p0=N'string property',@p1=N'keyZero',@p2=N'string zero'
> This query returns no rows when it should return exactly one. This is because @p0 and @p1 have been swapped.
--
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-17 22:25:51
|
[ http://216.121.112.228/browse/NH-2415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21108#action_21108 ]
Fabio Maulo commented on NH-2415:
---------------------------------
I would have a failing test.
The direction is this:
http://nhforge.org/blogs/nhibernate/archive/2008/10/04/the-best-way-to-solve-nhibernate-bugs-submit-good-unit-test.aspx
> HQL parameters not converted correctly to SQL
> ---------------------------------------------
>
> Key: NH-2415
> URL: http://216.121.112.228/browse/NH-2415
> Project: NHibernate
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.1.2.GA, 3.0.0.Beta2
> Reporter: Brian Berns
> Priority: Major
>
> Parameters added to an HQL query are jumbled in the resulting SQL. I have created a simple test case that demonstrates this problem using the BasicClassFixture:
> [Test]
> public void TestHQL()
> {
> var bc = InsertBasicClass(1);
> using (var session = OpenSession())
> using (var trans = session.BeginTransaction())
> {
> var hql = "from BasicClass bc where (bc.StringProperty = :prop) and (bc.StringMap[:key] = :value)";
> bc = session.CreateQuery(hql)
> .SetParameter("prop", "string property")
> .SetParameter("key", "keyZero")
> .SetParameter("value", "string zero")
> .UniqueResult<BasicClass>();
> Assert.NotNull(bc);
> session.Delete(bc);
> trans.Commit();
> }
> }
> The generated SQL is:
> exec sp_executesql N'select basicclass0_.id as id16_, basicclass0_.char_p as char2_16_, basicclass0_.class_p as class3_16_, basicclass0_.cinfo_p as cinfo4_16_, basicclass0_.dtm_p as dtm5_16_, basicclass0_.shrt_p as shrt6_16_, basicclass0_.int_p as int7_16_, basicclass0_.lng_p as lng8_16_, basicclass0_.flt_p as flt9_16_, basicclass0_.str_p as str10_16_, basicclass0_.ticks_p as ticks11_16_, basicclass0_.tf_p as tf12_16_, basicclass0_.yn_p as yn13_16_, basicclass0_.priv_fld as priv14_16_ from bc basicclass0_, bc_stmap stringmap1_ where basicclass0_.id=stringmap1_.bc_id and stringmap1_.strm_idx = @p0 and basicclass0_.str_p=@p1 and stringmap1_.str_val=@p2',N'@p0 nvarchar(4000),@p1 nvarchar(10),@p2 nvarchar(4000)',@p0=N'string property',@p1=N'keyZero',@p2=N'string zero'
> This query returns no rows when it should return exactly one. This is because @p0 and @p1 have been swapped.
--
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: Brian B. (JIRA) <nh...@gm...> - 2011-05-17 23:18:54
|
[ http://216.121.112.228/browse/NH-2415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21113#action_21113 ]
Brian Berns commented on NH-2415:
---------------------------------
Fabio, I don't understand what you mean by "I would have a failing test". In my bug report, I provided a simple, clear unit test that fails. What else can I do to demonstrate the bug?
> HQL parameters not converted correctly to SQL
> ---------------------------------------------
>
> Key: NH-2415
> URL: http://216.121.112.228/browse/NH-2415
> Project: NHibernate
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.1.2.GA, 3.0.0.Beta2
> Reporter: Brian Berns
> Priority: Major
>
> Parameters added to an HQL query are jumbled in the resulting SQL. I have created a simple test case that demonstrates this problem using the BasicClassFixture:
> [Test]
> public void TestHQL()
> {
> var bc = InsertBasicClass(1);
> using (var session = OpenSession())
> using (var trans = session.BeginTransaction())
> {
> var hql = "from BasicClass bc where (bc.StringProperty = :prop) and (bc.StringMap[:key] = :value)";
> bc = session.CreateQuery(hql)
> .SetParameter("prop", "string property")
> .SetParameter("key", "keyZero")
> .SetParameter("value", "string zero")
> .UniqueResult<BasicClass>();
> Assert.NotNull(bc);
> session.Delete(bc);
> trans.Commit();
> }
> }
> The generated SQL is:
> exec sp_executesql N'select basicclass0_.id as id16_, basicclass0_.char_p as char2_16_, basicclass0_.class_p as class3_16_, basicclass0_.cinfo_p as cinfo4_16_, basicclass0_.dtm_p as dtm5_16_, basicclass0_.shrt_p as shrt6_16_, basicclass0_.int_p as int7_16_, basicclass0_.lng_p as lng8_16_, basicclass0_.flt_p as flt9_16_, basicclass0_.str_p as str10_16_, basicclass0_.ticks_p as ticks11_16_, basicclass0_.tf_p as tf12_16_, basicclass0_.yn_p as yn13_16_, basicclass0_.priv_fld as priv14_16_ from bc basicclass0_, bc_stmap stringmap1_ where basicclass0_.id=stringmap1_.bc_id and stringmap1_.strm_idx = @p0 and basicclass0_.str_p=@p1 and stringmap1_.str_val=@p2',N'@p0 nvarchar(4000),@p1 nvarchar(10),@p2 nvarchar(4000)',@p0=N'string property',@p1=N'keyZero',@p2=N'string zero'
> This query returns no rows when it should return exactly one. This is because @p0 and @p1 have been swapped.
--
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-17 23:32:54
|
[ http://216.121.112.228/browse/NH-2415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21114#action_21114 ]
Fabio Maulo commented on NH-2415:
---------------------------------
Sorry Brian, I didn't see "BasicClassFixture".
Ok, I'll check it.
> HQL parameters not converted correctly to SQL
> ---------------------------------------------
>
> Key: NH-2415
> URL: http://216.121.112.228/browse/NH-2415
> Project: NHibernate
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.1.2.GA, 3.0.0.Beta2
> Reporter: Brian Berns
> Priority: Major
>
> Parameters added to an HQL query are jumbled in the resulting SQL. I have created a simple test case that demonstrates this problem using the BasicClassFixture:
> [Test]
> public void TestHQL()
> {
> var bc = InsertBasicClass(1);
> using (var session = OpenSession())
> using (var trans = session.BeginTransaction())
> {
> var hql = "from BasicClass bc where (bc.StringProperty = :prop) and (bc.StringMap[:key] = :value)";
> bc = session.CreateQuery(hql)
> .SetParameter("prop", "string property")
> .SetParameter("key", "keyZero")
> .SetParameter("value", "string zero")
> .UniqueResult<BasicClass>();
> Assert.NotNull(bc);
> session.Delete(bc);
> trans.Commit();
> }
> }
> The generated SQL is:
> exec sp_executesql N'select basicclass0_.id as id16_, basicclass0_.char_p as char2_16_, basicclass0_.class_p as class3_16_, basicclass0_.cinfo_p as cinfo4_16_, basicclass0_.dtm_p as dtm5_16_, basicclass0_.shrt_p as shrt6_16_, basicclass0_.int_p as int7_16_, basicclass0_.lng_p as lng8_16_, basicclass0_.flt_p as flt9_16_, basicclass0_.str_p as str10_16_, basicclass0_.ticks_p as ticks11_16_, basicclass0_.tf_p as tf12_16_, basicclass0_.yn_p as yn13_16_, basicclass0_.priv_fld as priv14_16_ from bc basicclass0_, bc_stmap stringmap1_ where basicclass0_.id=stringmap1_.bc_id and stringmap1_.strm_idx = @p0 and basicclass0_.str_p=@p1 and stringmap1_.str_val=@p2',N'@p0 nvarchar(4000),@p1 nvarchar(10),@p2 nvarchar(4000)',@p0=N'string property',@p1=N'keyZero',@p2=N'string zero'
> This query returns no rows when it should return exactly one. This is because @p0 and @p1 have been swapped.
--
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: Julian M. (JIRA) <nh...@gm...> - 2011-05-31 16:19:50
|
[ http://216.121.112.228/browse/NH-2415?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Julian Maughan resolved NH-2415.
--------------------------------
Resolution: Fixed
Fix Version/s: 3.2.0Beta2
Committed - now passing - test to trunk (r5898).
> HQL parameters not converted correctly to SQL
> ---------------------------------------------
>
> Key: NH-2415
> URL: http://216.121.112.228/browse/NH-2415
> Project: NHibernate
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.1.2.GA, 3.0.0.Beta2
> Reporter: Brian Berns
> Priority: Major
> Fix For: 3.2.0Beta2
>
>
> Parameters added to an HQL query are jumbled in the resulting SQL. I have created a simple test case that demonstrates this problem using the BasicClassFixture:
> [Test]
> public void TestHQL()
> {
> var bc = InsertBasicClass(1);
> using (var session = OpenSession())
> using (var trans = session.BeginTransaction())
> {
> var hql = "from BasicClass bc where (bc.StringProperty = :prop) and (bc.StringMap[:key] = :value)";
> bc = session.CreateQuery(hql)
> .SetParameter("prop", "string property")
> .SetParameter("key", "keyZero")
> .SetParameter("value", "string zero")
> .UniqueResult<BasicClass>();
> Assert.NotNull(bc);
> session.Delete(bc);
> trans.Commit();
> }
> }
> The generated SQL is:
> exec sp_executesql N'select basicclass0_.id as id16_, basicclass0_.char_p as char2_16_, basicclass0_.class_p as class3_16_, basicclass0_.cinfo_p as cinfo4_16_, basicclass0_.dtm_p as dtm5_16_, basicclass0_.shrt_p as shrt6_16_, basicclass0_.int_p as int7_16_, basicclass0_.lng_p as lng8_16_, basicclass0_.flt_p as flt9_16_, basicclass0_.str_p as str10_16_, basicclass0_.ticks_p as ticks11_16_, basicclass0_.tf_p as tf12_16_, basicclass0_.yn_p as yn13_16_, basicclass0_.priv_fld as priv14_16_ from bc basicclass0_, bc_stmap stringmap1_ where basicclass0_.id=stringmap1_.bc_id and stringmap1_.strm_idx = @p0 and basicclass0_.str_p=@p1 and stringmap1_.str_val=@p2',N'@p0 nvarchar(4000),@p1 nvarchar(10),@p2 nvarchar(4000)',@p0=N'string property',@p1=N'keyZero',@p2=N'string zero'
> This query returns no rows when it should return exactly one. This is because @p0 and @p1 have been swapped.
--
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: Brian B. (JIRA) <nh...@gm...> - 2011-05-31 16:27:01
|
[ http://216.121.112.228/browse/NH-2415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21244#action_21244 ]
Brian Berns commented on NH-2415:
---------------------------------
Thank you!
> HQL parameters not converted correctly to SQL
> ---------------------------------------------
>
> Key: NH-2415
> URL: http://216.121.112.228/browse/NH-2415
> Project: NHibernate
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.1.2.GA, 3.0.0.Beta2
> Reporter: Brian Berns
> Priority: Major
> Fix For: 3.2.0Beta2
>
>
> Parameters added to an HQL query are jumbled in the resulting SQL. I have created a simple test case that demonstrates this problem using the BasicClassFixture:
> [Test]
> public void TestHQL()
> {
> var bc = InsertBasicClass(1);
> using (var session = OpenSession())
> using (var trans = session.BeginTransaction())
> {
> var hql = "from BasicClass bc where (bc.StringProperty = :prop) and (bc.StringMap[:key] = :value)";
> bc = session.CreateQuery(hql)
> .SetParameter("prop", "string property")
> .SetParameter("key", "keyZero")
> .SetParameter("value", "string zero")
> .UniqueResult<BasicClass>();
> Assert.NotNull(bc);
> session.Delete(bc);
> trans.Commit();
> }
> }
> The generated SQL is:
> exec sp_executesql N'select basicclass0_.id as id16_, basicclass0_.char_p as char2_16_, basicclass0_.class_p as class3_16_, basicclass0_.cinfo_p as cinfo4_16_, basicclass0_.dtm_p as dtm5_16_, basicclass0_.shrt_p as shrt6_16_, basicclass0_.int_p as int7_16_, basicclass0_.lng_p as lng8_16_, basicclass0_.flt_p as flt9_16_, basicclass0_.str_p as str10_16_, basicclass0_.ticks_p as ticks11_16_, basicclass0_.tf_p as tf12_16_, basicclass0_.yn_p as yn13_16_, basicclass0_.priv_fld as priv14_16_ from bc basicclass0_, bc_stmap stringmap1_ where basicclass0_.id=stringmap1_.bc_id and stringmap1_.strm_idx = @p0 and basicclass0_.str_p=@p1 and stringmap1_.str_val=@p2',N'@p0 nvarchar(4000),@p1 nvarchar(10),@p2 nvarchar(4000)',@p0=N'string property',@p1=N'keyZero',@p2=N'string zero'
> This query returns no rows when it should return exactly one. This is because @p0 and @p1 have been swapped.
--
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-31 16:47:01
|
[ http://216.121.112.228/browse/NH-2415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21245#action_21245 ]
Fabio Maulo commented on NH-2415:
---------------------------------
Thanks Julian to check it.
I have missed this issue on past sunday.
> HQL parameters not converted correctly to SQL
> ---------------------------------------------
>
> Key: NH-2415
> URL: http://216.121.112.228/browse/NH-2415
> Project: NHibernate
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.1.2.GA, 3.0.0.Beta2
> Reporter: Brian Berns
> Priority: Major
> Fix For: 3.2.0Beta2
>
>
> Parameters added to an HQL query are jumbled in the resulting SQL. I have created a simple test case that demonstrates this problem using the BasicClassFixture:
> [Test]
> public void TestHQL()
> {
> var bc = InsertBasicClass(1);
> using (var session = OpenSession())
> using (var trans = session.BeginTransaction())
> {
> var hql = "from BasicClass bc where (bc.StringProperty = :prop) and (bc.StringMap[:key] = :value)";
> bc = session.CreateQuery(hql)
> .SetParameter("prop", "string property")
> .SetParameter("key", "keyZero")
> .SetParameter("value", "string zero")
> .UniqueResult<BasicClass>();
> Assert.NotNull(bc);
> session.Delete(bc);
> trans.Commit();
> }
> }
> The generated SQL is:
> exec sp_executesql N'select basicclass0_.id as id16_, basicclass0_.char_p as char2_16_, basicclass0_.class_p as class3_16_, basicclass0_.cinfo_p as cinfo4_16_, basicclass0_.dtm_p as dtm5_16_, basicclass0_.shrt_p as shrt6_16_, basicclass0_.int_p as int7_16_, basicclass0_.lng_p as lng8_16_, basicclass0_.flt_p as flt9_16_, basicclass0_.str_p as str10_16_, basicclass0_.ticks_p as ticks11_16_, basicclass0_.tf_p as tf12_16_, basicclass0_.yn_p as yn13_16_, basicclass0_.priv_fld as priv14_16_ from bc basicclass0_, bc_stmap stringmap1_ where basicclass0_.id=stringmap1_.bc_id and stringmap1_.strm_idx = @p0 and basicclass0_.str_p=@p1 and stringmap1_.str_val=@p2',N'@p0 nvarchar(4000),@p1 nvarchar(10),@p2 nvarchar(4000)',@p0=N'string property',@p1=N'keyZero',@p2=N'string zero'
> This query returns no rows when it should return exactly one. This is because @p0 and @p1 have been swapped.
--
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
|