Since when edit a web content, liferay automatically creates new version of an article, I want to get the latest version of a specific article. I used the dynamic query as follows:
DynamicQuery query = DynamicQueryFactoryUtil.forClass(JournalArticle.class, PortletClassLoaderUtil.getClassLoader());
query.setProjection(ProjectionFactoryUtil.max("version"));
List<JournalArticle> jList = (List<JournalArticle>)JournalArticleLocalServiceUtil.dynamicQuery(query);
I searched on google and notice ProjectionFactoryUtil.max("version")
was used a lot. But in my case, exceptions have thrown:
"java.lang.Double cannot be cast to com.liferay.portlet.journal.model.JournalArticle"
Am I missing something?