how to use string left function in hql

后端 未结 2 387
眼角桃花
眼角桃花 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:46

    Yes, left() is not supported by the MySQLDialect. See the list of HQL supported functions on API docs.

    Now you have left with 2 options.

    1. Use session.createSQLQuery() method.
    2. Create Your own Dialect class by extending the MySQLDialect and register the function there. This is told at hibernate forum here explained well in a blog post here.

提交回复
热议问题