Uploaded image for project: 'Recommendation Application'
  1. Recommendation Application
  2. XRECOMMEND-12

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 0.12
    • None
    • Unknown

    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.

      PS: This post was co-written with Claude Code.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              tmortagne Thomas Mortagne
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated: