MySQL sounds like query to Hibernate

hibernate, java, mysql

Solution

From mysql doc :

expr1 SOUNDS LIKE expr2

This is the same as SOUNDEX(expr1) = SOUNDEX(expr2)

And `soundex`seems supported by MySQLDialect. So doing something like this:

SELECT * FROM items WHERE soundex(itemname) = soundex('some name')

or in HQL

Query q = session.createQuery
   ("from items  e where soundex(e.itemname)  =  soundex('%some name%') ");

should work.

Problem

I'm pretty new to Hibernate, Is there a way that I can convert the following MySQL query to HQL or a Criteria query: ``` SELECT * FROM items WHERE itemname SOUNDS LIKE 'some name' ``` If not, are there any workarounds to get a similar functionality implemented using Hibernate?

Original source