invoke sql function using nhibernate?
- by net205
I want to query like this:
select * from table where concat(',', ServiceCodes, ',') like '%,33,%';
select * from table where (','||ServiceCodes||',') like '%,33,%';
so, I wrote this code:
ICriteria cri = NHibernateSessionReader.CreateCriteria(typeof(ConfigTemplateList));
cri.Add(Restrictions.Like(Projections.SqlFunction("concat", NHibernateUtil.String, Projections.Property("ServiceCodes")), "%,33,%"));
I get sql similar :
select * from table where (ServiceCodes) like '%,33,%';
But it is not what I want,how to do it???
thanks!