How can we use case insensitive propertyName in criteria in nHibernate -
in simple sql can write queries field names case insensitive. example, want query on student
table , has 1 field called name
. can write query (in ms sql):
select * student name = "john"
see here have used name
instead of name
, still runs properly.
but when write criteria in nhibernate this
session.createcriteria("student") .add(restrictions.eq("name","john")).list()
it fails error could not resolve property: name of student
.
is there way can make field/property names case insensitive in criteria direct sql queries.
thanks
short answer: can't. property names case sensitive.
long answer: can parse user's input , use reflection find correct property names.
Comments
Post a Comment