2013年9月6日星期五

SSH query.setParameter query throw java.lang.reflect.InvocationTargetException exception

Problem statement is as follows :
Number n = (Number) this.getSession (true). createQuery ( "select count (c) from Comment c where c.article_id =: articleId" ). setParameter ("articleId" ;, articleId). uniqueResult ();
determine the basic problem lies in the setParameter ("articleId", articleId) , and modify the query to a fixed value "select count (c) from Comment c where c.article_id = 1" is normal

Note : Remove struts2 antlr-2.7.2.jar reserved hibernate antlr-2.7.6.jar. database Mysql5.
------ Solution -------- ------------------------------------
should not recognize it is a placeholder
------ For reference only ---------------------------------------
Why do not you put this long statement to write separately , so you ought to locate where an exception is thrown , why have to write a single line ?

------ For reference only ---------------------------------- -----


do not say that the problem lies in the setParameter ("articleId", articleId), throwing java.lang.reflect.InvocationTargetException ( abnormal reflexes )

没有评论:

发表评论