This issue has been created
 
 
Reader Application / cid:jira-generated-image-avatar-d1aa42e6-bb77-401b-863a-43411fa23c4a XAREADER-5 Open

The flag queries compare a long property with a string

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-d2c1a95f-ceaa-4726-95dd-c4f8041f514e Thomas Mortagne created this issue on 17/Nov/26 15:11
 
Summary: The flag queries compare a long property with a string
Issue Type: cid:jira-generated-image-avatar-d1aa42e6-bb77-401b-863a-43411fa23c4a Bug
Affects Versions: 1.0-rc-2
Assignee: Unassigned
Created: 17/Nov/26 15:11
Priority: cid:jira-generated-image-static-major-f3f9ac18-282b-4e4a-9e66-5fb1a69e3105 Major
Reporter: Thomas Mortagne
Description:

ReaderCode.DefaultPressReviewFormatter and ReaderCode.ReaderArticlesMacro compare the key long property of the flags with a string:

fkey.value = '$flag'

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.

Bind the flag as a Long query parameter instead (which also avoids injecting it in the query). This works with all the databases and all the Hibernate versions.