You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2015/07/21 13:26:04 UTC
[jira] [Commented] (OPENJPA-2601) 'hint' element in orm:xml is
ignored
[ https://issues.apache.org/jira/browse/OPENJPA-2601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14634980#comment-14634980 ]
ASF subversion and git services commented on OPENJPA-2601:
----------------------------------------------------------
Commit 1692088 from [~struberg] in branch 'openjpa/trunk'
[ https://svn.apache.org/r1692088 ]
OPENJPA-2601 fix 'hint' element in orm.xml parsing
Txs to Kariem Hussein for the patch!
> '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
> 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)