how to use string left function in hql

后端 未结 2 360
眼角桃花
眼角桃花 2021-01-20 04:01

I have a sql query like this

select column from table where path = left(\'INPUTSTRING\', length(path));

and trying to accomplish it in hql

2条回答
  •  生来不讨喜
    2021-01-20 04:28

    I'm not sure if HQL does this for you , but you can use IQuery/session.CreateSQLQuery() to use a raw SQL query to populate a mapped entity. I've never used it for substrings, but have used it for aggregate functions. Check chapter 13 of the NHibernate docs and see if that does it for you. You can check the query substitution available in Nhibernate - here

提交回复
热议问题