Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-2601

'hint' element in orm:xml is ignored

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.0, 2.4.0
    • Fix Version/s: 2.4.1
    • Component/s: criteria
    • Labels:
      None

      Description

      It should be possible to set query hints in Java code, or in orm.xml, but it seems the orm:hint element is ignored.

      The following two options should result in the same query:

      1. Java only:
        em.createQuery("Select e from MyEntity e where e.type = 'literal'")
          .setHint(QueryHints.HINT_USE_LITERAL_IN_SQL, true)
          .getResultList()
        
      2. Named query
        • Define the query and the hint in orm.xml
          <named-query name="Query1">
              <query>Select e from MyEntity e where e.type = 'literal'</query>   
              <hint name="openjpa.hint.UseLiteralInSQL" value="true" />
          </named-query>
          
        • And then call the query without additional information
          em.createNamedQuery("Query1")
            .getResultList()
          

      However, (2) does not correctly take the query hint into account and thus literals are replaced with SQL positional parameters.

        Attachments

          Activity

            People

            • Assignee:
              struberg Mark Struberg
              Reporter:
              kariem Kariem Hussein

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment