日期:2014-05-17  浏览次数:20662 次

SSH query.setParameter查询抛java.lang.reflect.InvocationTargetException异常
问题语句如下:
Number n=(Number)this.getSession(true).createQuery("select count(c) from Comment c where c.article_id= :articleId").setParameter("articleId", articleId).uniqueResult();
基本确定问题出在setParameter("articleId", articleId)上,将查询修改为固定值"select count(c) from Comment c where c.article_id= 1"则正常

注:移除struts2 antlr-2.7.2.jar保留hibernate antlr-2.7.6.jar.数据库为Mysql5.
hibernate ssh mysql 异常 hql

------解决方案--------------------
应该是占位符不能识别吧