-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: hibernate.query.substitutions problem
PostPosted: Fri May 09, 2008 6:35 am 
Newbie

Joined: Thu Dec 06, 2007 10:07 pm
Posts: 4
Hibernate version:
NHibernate 1.2.1
And underlaying Database system is SQL Server 2000


Hi all,
Base on hibernate setting
"hibernate.query.substitutions" value="true 1, false 9, yes 'Y', no 'N'"

The situations is when I issue following HQL thing will be fine.
Code:
string hql = "select k.SubjectId from KBUser as k where k.Disabled=false";


Then it could be observed(via profiler within SQLServer toolset) that hibernate translate to SQL
Code:
exec sp_executesql N'select kbuser0_.SUBJECT_ID as x0_0_ from KBUSER kbuser0_ where (kbuser0_.DISABLED=@p0 )', N'@p0 bit', @p0 = 9


It's okay and it all I want, but if I change HQL like following
Code:
string hql = "select k.SubjectId from KBUser as k where k.Disabled=?";

and set the parameter to false(yes the .Net boolean type)
Code:
session.Find(hql, false)

I got hibernate translate to SQL
Code:
exec sp_executesql N'select kbuser0_.SUBJECT_ID as x0_0_ from KBUSER kbuser0_ where (kbuser0_.DISABLED=@p0 )', N'@p0 bit', @p0 = 0


It seems that Hibernate does not substitute the false parameter value to 9 and by default using 0 to do translation.

How can I fix such problem? Is a bug or is my misunderstanding?
Please help on this.
Thanks in advance!


Top
 Profile  
 
 Post subject: Ca somebody help on this?
PostPosted: Mon May 12, 2008 5:55 am 
Newbie

Joined: Thu Dec 06, 2007 10:07 pm
Posts: 4
Hi is this problem a NHibernate bug or my misusing NHibernate?
Anybody can please help on this?
Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.