R – NHibernate: Criteria Issue with parameter type

criterianhibernate

I have a varchar field in a table, mapped to string property on a class. Pretty simple stuff, however when I create a criteria to retieve enities based on this field, NHibernare is generating invalid sql. The where clause looks like "Where accountnum = 120001", which won't work with a varchar obviously. Any ideas?

Best Answer

NHibernate should be generating a parameterized statement ... something like "Where accountnum = @p1". If it is not, then something is configured wrong.

Related Topic