求大神
List mmtReplies = (List)CacheUtils.getValueFromCache("CommonData", mmtArticle.getId() + "_" + page1 + "_MMTMmtReplies");
if (mmtReplies == null) {
mmtReplies = this.jpaTemplate.executeFind(new JpaCallback(mmtArticle, page1) {
public List<MMT_Reply> doInJpa(EntityManager em) throws PersistenceException {
return em.createQuery("SELECT i FROM MMT_Reply i WHERE i.mmtArticle.id=? ORDER BY i.date DESC").setParameter(1, this.val$mmtArticle.getId()).setFirstResult((this.val$page1.intValue() - 1) * 10).setMaxResults(10).getResultList();
}
});
CacheUtils.putValueToCache("CommonData", mmtArticle.getId() + "_" + page1 + "_MMTMmtReplies", mmtReplies);
}
我想问setParameter(1, this.val$mmtArticle.getId()).setFirstResult((this.val$page1.intValue() - 1)中的
this.val$mmtArticle 和 this.val$page1 是什么,,,
------解决方案--------------------
val$page1是Integer类型,Integer有intValue()方法返回int类型。。
比如
Integer val$page1 = 1000;
int i = val$page1.intValue();
一般不会用$来做变量名,比如可以valPage或val_page
------解决方案--------------------帮顶!!