This issue has been created
 
 
Wiki Analyzer / cid:jira-generated-image-avatar-4aabf5b6-2879-4c75-8f71-ad549a326e50 WANALYZER-1 Open

The statistics compare the hidden flag of the pages with a number

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-e8fd3fd5-f1ff-4495-ac5e-5cfb6a44ce4d Thomas Mortagne created this issue on 17/Nov/26 15:11
 
Summary: The statistics compare the hidden flag of the pages with a number
Issue Type: cid:jira-generated-image-avatar-4aabf5b6-2879-4c75-8f71-ad549a326e50 Bug
Affects Versions: 1.1
Assignee: Unassigned
Created: 17/Nov/26 15:11
Priority: cid:jira-generated-image-static-major-5cf5032c-cacb-4b2d-ae7d-df254a3e7d44 Major
Reporter: Thomas Mortagne
Description:

WikiAnalyzer.Statistics compares the hidden flag of the pages with a number, in an HQL and an XWQL query:

doc.hidden <> 1

Since Hibernate 6, HQL checks the types of both sides of a comparison when the query is parsed, and rejects incompatible ones (SemanticException: Cannot compare left expression of type ... with right expression of type ...). XWiki is moving to Hibernate 7 (XWIKI-19708), where these queries will fail on every database. With Hibernate 5 the literal is copied as is in the SQL, so the queries rely on the database converting it implicitly, which not all databases do.

This probably already fails on PostgreSQL, where the hidden flag is stored in a boolean column which can't be compared with an integer.

Compare it with a boolean instead (doc.hidden <> true). This works with all the databases and all the Hibernate versions.