2016-07-19 101 views
0

我在我的hbm.xml文件中添加了命名查詢,並且無法正常工作,如下面的代碼所示。像hibernate命名查詢

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

和我打電話它作爲

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

應用程序無法UP。任何幫助將非常感激。

+0

添加stacktrace pls。我猜你的課是'類別'不'類別' – Apostolos

+1

檢查與'從類別ca在哪裏ca.name喜歡:名稱' – Apostolos

+0

@Apostolos謝謝。這是我的錯誤。 :) –

回答

0

請使用from Category ca where ca.name like :name 在編寫hql查詢時不要使用as