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

'hint' element in orm:xml is ignored

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.3.0, 2.4.0
    • 2.4.1
    • criteria
    • 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

            struberg Mark Struberg
            kariem Kariem Hussein
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: