Search code examples
javahibernatehqlnamed-query

Like in hibernate named query


I added named query in my hbm.xml file and is not working, as code below.

<query name="ca.getChildCategories"><![CDATA[
from category as ca where ca.name like :name
        ]]></query>

and am calling it as

getHibernateTemplate().findByNamedQueryAndNamedParam("ca.getChildCategories" , 
                                new String[] { "name"},
                                new Object[] { likeKey});

The application is not able to UP. Any help wil be very much appreciated.


Solution

  • please use from Category ca where ca.name like :name dont use as when writing hql queries.