sorry, dharmendra.pandey.
your answer is great!
but, my fault that just easy question.
sorry about that.
because, i want to use the 'instr' function.
for example. 1. correct code.
Code:
List list = session.createQuery("from Category c where path like :searchPath and instr(c.path, '/', 1, :searchCount) = 0")
.setParameter("searchPath", topEntry.getPath()+"%")
.setParameter("searchCount", new Integer(searchCount))
.list();
2. my purpose code
Code:
List list = session.createCriteria(Category.class)
where path like :searchPath and instr(c.path, '/', 1, :searchCount) = 0")
.add(Restirctions.eq(path, topEntry.getPath(), MatchMode.END))
.add(Restrictions.sqlRestriction("instr(path, '/', 1, "+searchCount+")) = 0")
.list();
HQL can parse 'instr' function.
but, 'Restrictions' is not support 'instr' function. so that, i use sqlRestrictions.
but sqlRestrcitons use nativieSql, so hibernate recognized 'path' is not unknow field.
please, give me the answer, repeat.
Thank you.