On Tue, Aug 31, 2010 at 12:35 PM, Diego Mijelshon
<[email protected]> wrote:
> Query substitution shouldn't change ANYTHING on the criteria query.
> The idea behind query substitution is being able to write DB-agnostic HQL.
> That way, you can write something like "... where MyBoolProp = true" and
> have that true LITERAL (not string) translated to 1, 'T', or whatever the DB
> uses to represent a true value.
> Test:
> Declare a Foo class with a string property named Data.
> Execute this criteria:
>
> session.CreateCriteria<Foo>().Add(Restrictions.Eq("Data", "true") || Restrictions.Eq("Data", "12.3")).List();
>
> This is the resulting SQL using MsSql 2008:
> SELECT
>     this_.Id as Id0_0_,
>     this_.[Data] as Data2_0_0_
> FROM
>     Foo this_
> WHERE
>     (
>         this_.[Data] = @p0
>         or this_.[Data] = @p1
>     );
> @p0 = 'true' [Type: String (4000)], @p1 = '12.3' [Type: String (4000)]
>

Ok.  Thanks for the example.

-- 
thanks

cliff

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