Hi,
I have a NHibernate repository ARep with a method called "GetByItemNo(string itemNo)".
When I query the method with a value with no underscore, the method works perfectly and it returns the object I'm expecting. When I query the method with a value containing underscores, it returns NULL (and it's not true, the object I'm looking for has a corresponding row in the db).
Here's the content of my method :
public ObjectA GetByItemNo(string itemNo) { ObjectA result = null; ... some code ... ICriteria criteria = session.CreateCriteria(typeof(ObjectA)); criteria.Add(Expression.Eq("ItemNo", itemNo)); criteria.SetMaxResults(1); result = criteria.UniqueResult<ObjectA>(); ... some code ... return result; }
It seems like NHibernate doesn't react correctly when I use the "Expression" Eq with a value containing underscores.
Why ? What is the solution to that ?
Thanks, Claude
|