Julian,

Diagnosis is an entity class.  (Is a table per class mapping)

Changing the query in NH 3.0 GA to:

Session.Query<Diagnosis>().Where(diagnosis => diagnosis.Id != null);

will produce correct results  (where Id is a Guid field primary key.)

Database is MSSQL 2005.

I am just playing around as I've never looked at the nh source before.
Making the following patch and my local unit tests pass again against
3.0.0.GA.

Index: nhibernate/src/NHibernate/Hql/Ast/HqlTreeBuilder.cs
===================================================================
--- nhibernate/src/NHibernate/Hql/Ast/HqlTreeBuilder.cs (revision
5299)
+++ nhibernate/src/NHibernate/Hql/Ast/HqlTreeBuilder.cs (working copy)
@@ -165,7 +165,7 @@
                                case TypeCode.DateTime:
                                        return new HqlStringConstant(_factory, 
"\'" + (DateTime)value +
"\'");
                                case TypeCode.Boolean:
-                                       return new HqlStringConstant(_factory, 
"\'" + ((bool)value ?
"true" : "false") + "\'");
+                               return ((bool) value ? (HqlConstant) new
HqlTrue(_factory) : new HqlFalse(_factory));
                                default:
                                        throw new 
NotSupportedException(string.Format("The constant for
'{0}' is not supported", value));
                        }

Not sure what that breaks! I don't have an environment setup to run
the full Nhibernate test suite but I'll see what I can do.

Cheers,
Jason


On Dec 7, 3:28 pm, Julian <[email protected]> wrote:
> Is 'diagnosis' defined as a string or bool? You really need to provide
> more information, such as your mappings and class definitions.
>
> On Dec 7, 12:32 pm, jafin <[email protected]> wrote:
>
> > From some code we use with NH 3.0 Alpha 2:
>
> > Session.Query<Diagnosis>().Where(diagnosis => true);
>
> > SQL Output (NH 3.0 Alpha2) -- Working as expected
> > ------------------------------------
> > NHibernate: select cast(count(*) as INTEGER) as col_0_0_ from
> > Diagnosis diagnosis0_ where @p0=1;@p0 = True [Type: Int32 (0)]
>
> > SQL output (NH 3.0 GA) -- not returning results.
> > ------------------------------------
> > select cast(count(*) as INTEGER) as col_0_0_ from Diagnosis
> > diagnosis0_ where @p0='true';@p0 = 'True' [Type: String (0)]
>
> > I'm assuming I've hit a breaking change, just after advise on how to
> > resolve it?
>
> > Thanks,
> > Jason
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to