[ https://issues.apache.org/jira/browse/OPENJPA-2601?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mark Struberg resolved OPENJPA-2601. ------------------------------------ Resolution: Fixed Fix Version/s: 2.4.1 txs for the patch, Kariem! > '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.3.0, 2.4.0 > Reporter: Kariem Hussein > Assignee: Mark Struberg > Fix For: 2.4.1 > > Attachments: 0001-OPENJPA-2601-Test-case-with-hint-in-orm.xml.patch, > 0002-OPENJPA-2601-Correct-element-name-for-query-hint.patch > > > 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)