2016-03-08 46 views
0

我有一个显示Liferay内容的自定义门户组件,我必须能够对这些内容进行评分。 我恢复此内容的收视信息使用LIferay评估内容API

RatingsStats currentRate = RatingsStatsLocalServiceUtil.getStats(JournalArticle.class.getName(), 
        article.getResourcePrimKey()); 

,但疯狂的事情是,当我更新此表中的任何领域一样currentRate.getTotalEntries(),该数据没有更新。

我附上了完整的方法和日志。

article = JournalArticleLocalServiceUtil.getArticle(primKey);   
RatingsStats currentRate = RatingsStatsLocalServiceUtil.getStats(JournalArticle.class.getName(), 
        article.getResourcePrimKey()); 
LOG.debug("ratingStats entrada a editar: " + currentRate.getStatsId()); 
LOG.debug("currentRate.getTotalEntries() BEFORE: " + currentRate.getTotalEntries()); 
currentRate.setTotalEntries(currentRate.getTotalEntries()+1); 
LOG.debug("currentRate.getTotalEntries() AFTER: " + currentRate.getTotalEntries()); 

的LOG如下:

11:35:18,634 DEBUG [AgregadoresContenidosController:262] ratingStats entrada a editar: 110551 
11:35:18,634 DEBUG [AgregadoresContenidosController:263] currentRate.getTotalEntries() BEFORE: 0 
11:35:18,635 DEBUG [AgregadoresContenidosController:265] currentRate.getTotalEntries() AFTER: 1 

每次我getTotalEntries,该值时,不更新 '0'。

有什么想法?

在此先感谢

回答

0

我想对数据库更新将与方法的设置自动地,但是我错了。

为了在DDBB中进行更新,需要以下行。

RatingsStatsLocalServiceUtil.updateRatingsStats(currentRate); 

疑问解决:)