Kariem Hussein created OPENJPA-2601:
---------------------------------------

             Summary: 'hint' element in orm:xml is ignored
                 Key: OPENJPA-2601
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2601
             Project: OpenJPA
          Issue Type: Bug
          Components: criteria
    Affects Versions: 2.4.0, 2.3.0
            Reporter: Kariem Hussein


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:
# Java only:
{code:java}
em.createQuery("Select e from MyEntity e where e.type = 'literal'")
  .setHint(QueryHints.HINT_USE_LITERAL_IN_SQL, true)
  .getResultList()
{code}
# Named query
#- Define the query and the hint in orm.xml
{code: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>
{code}
#- And then call the query without additional information
{code:java}
em.createNamedQuery("Query1")
  .getResultList()
{code}

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



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to