This issue has been created
 
 
Recommendation Application / cid:jira-generated-image-avatar-8bdd686d-0a4b-4066-9513-cb51243c2983 XRECOMMEND-12 Open

The recommendation queries compare the date of the pages with a string

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-1708f591-86fc-41c8-80af-c498685f76a7 Thomas Mortagne created this issue on 17/Nov/26 15:11
 
Summary: The recommendation queries compare the date of the pages with a string
Issue Type: cid:jira-generated-image-avatar-8bdd686d-0a4b-4066-9513-cb51243c2983 Bug
Affects Versions: 0.12
Assignee: Unassigned
Created: 17/Nov/26 15:11
Priority: cid:jira-generated-image-static-major-a0b9de1d-2af8-4462-b7a5-d4514f5162cb Major
Reporter: Thomas Mortagne
Description:

RecommendationsCode.ProfilesScheduler and RecommendationsCode.SendProfile_PagesList compare the date of the pages with a string:

doc.date >= '${updateDate}'
doc.date >= '${request.get('updateDate')}'

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.

On Oracle, this already depends on the date format of the database session (NLS_DATE_FORMAT).

Bind the date as a java.util.Date query parameter instead (which also avoids injecting a request parameter in the query). This works with all the databases and all the Hibernate versions.