You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Patrick Linskey (JIRA)" <ji...@apache.org> on 2007/07/04 16:23:05 UTC

[jira] Commented: (OPENJPA-273) Native functions in JPQL; functions available in more clauses

    [ https://issues.apache.org/jira/browse/OPENJPA-273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12510199 ] 

Patrick Linskey commented on OPENJPA-273:
-----------------------------------------

Another potential approach: create some syntax for escaping a part of a query to SQL, and then permit nested escapes back to JPQL (or at least JPQL parameters and path expressions)  from within the SQL bits. The query that I mentioned above might look like so:

    select :sql{stdev(:jpql{emp.salary})} from Employee emp

This has the advantage of permitting arbitrary SQL (excepting the escape sequence, which is ':jpql{' here) to be used. So, we can do an EXTRACT function like so:

    select distinct :sql{EXTRACT(year FROM :jpql{emp.hireDate})} from Employee emp

> Native functions in JPQL; functions available in more clauses
> -------------------------------------------------------------
>
>                 Key: OPENJPA-273
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-273
>             Project: OpenJPA
>          Issue Type: New Feature
>          Components: jdbc, kernel, query
>    Affects Versions: 0.9.0, 0.9.6, 0.9.7
>            Reporter: Patrick Linskey
>         Attachments: OPENJPA-273.patch
>
>
> JPQL has rather limited support for functions, in two ways. First, only a limited number of commonly-available functions are available in the language, and second, functions can only be used in a limited number of places in the grammar. This can be, well, limiting.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.