Nhibernate - How to get rid of unwanted text cast

Posted by Nicolas Cornu on Stack Overflow See other posts from Stack Overflow or by Nicolas Cornu
Published on 2010-05-20T20:12:41Z Indexed on 2010/05/21 21:40 UTC
Read the original article Hit count: 453

Filed under:
|

Hello,

I am using Nhibernate 2 and PostgreSql

The above code generate a query with a cast on expression

res = _session.CreateCriteria(typeof(C))
                    .Add(Restrictions.Eq("Exp", Exp))
                    .AddOrder(new Order("Fr", false))
                    .SetMaxResults(MW)
                    .List<C>();

Exp is a character varying(30)

In the query: SELECT ... FROM table WHERE Exp = 'text':: text ...

I want to get rid of cast 'text":: text beacause the index is not used.

Nicolas

© Stack Overflow or respective owner

Related posts about nhibernate

Related posts about postgresql