-
Type:
Bug
-
Status: Closed
-
Resolution: Fixed
-
Affects Version/s: 7.0.0 M5
-
Component/s: Web Content > Web Content Administration
-
Labels:
-
Branch Version/s:6.2.x
-
Backported to Branch:Committed
-
Story Points:3
-
Fix Priority:3
-
Git Pull Request:
the find method takes into account only the latest version through a left join, but the count method looks in all versions and then does a distinct on the article Id.
SELECT COUNT(DISTINCT JournalArticle.articleId) AS COUNT_VALUE FROM JournalArticle WHERE (groupId = ?) AND (classNameId = ?) AND ([$DDM_STRUCTURE_KEY$]) AND ([$STATUS$])
finds any article (including version history) that match the where clause and then filters the article Ids to be distinct,
but
SELECT JournalArticle.* FROM JournalArticle LEFT JOIN JournalArticle tempJournalArticle ON [$STATUS_JOIN$] AND (JournalArticle.groupId = tempJournalArticle.groupId) AND (JournalArticle.articleId = tempJournalArticle.articleId) AND (JournalArticle.version < tempJournalArticle.version) WHERE (JournalArticle.groupId = ?) AND (JournalArticle.classNameId = ?) AND ([$DDM_STRUCTURE_KEY$]) AND ([$STATUS$]) AND (tempJournalArticle.id_ IS NULL) ORDER BY JournalArticle.id_ ASC
finds only the latest versions through the left inner join.
the results should be the same between the count and find methods so the count should be changed to the following:
SELECT COUNT(DISTINCT JournalArticle.articleId) AS COUNT_VALUE FROM JournalArticle LEFT JOIN JournalArticle tempJournalArticle ON [$STATUS_JOIN$] AND (JournalArticle.groupId = tempJournalArticle.groupId) AND (JournalArticle.articleId = tempJournalArticle.articleId) AND (JournalArticle.version < tempJournalArticle.version) WHERE (JournalArticle.groupId = ?) AND (JournalArticle.classNameId = ?) AND ([$DDM_STRUCTURE_KEY$]) AND ([$STATUS$]) AND (tempJournalArticle.id_ IS NULL)
- relates
-
LPE-14621 Journal countByG_C_S and findByG_C_S methods use different sql which could generate different results
-
- Closed
-