[ 
https://issues.apache.org/jira/browse/OPENJPA-2601?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mark Struberg reassigned OPENJPA-2601:
--------------------------------------

    Assignee: Mark Struberg

> '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
>
> 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