jsr338-experts@jpa-spec.java.net

[jsr338-experts] Re: JPQL function invocation

From: Werner Keil <werner.keil_at_gmx.net>
Date: Thu, 10 Mar 2011 02:16:28 +0530

About the syntax, I'd say yes.

After joining Eclipse JPA Diagram Editor as Interested Party, I was
wondering which parts may be subject to change there?
It just graduated to Dali, where beside the obvious EclipseLink the new spec
will have its effect. Not for Indigo any more, probably next year?

Werner

----- Original Message -----
From: "Linda DeMichiel" <linda.demichiel_at_oracle.com>
To: <jsr338-experts_at_jpa-spec.java.net>
Cc: <linda.demichiel_at_oracle.com>
Sent: Thursday, March 10, 2011 12:24 AM
Subject: [jsr338-experts] Re: JPQL function invocation


>I haven't gotten any responses to this.
>
> Should I interpret silence as consent and add this to the
> spec? Please let me know one way or the other.
>
> thanks,
>
> -Linda
>
>
> On 3/7/2011 1:20 PM, Linda DeMichiel wrote:
>> In JPA 2.0 we extended the criteria API with the CriteriaBuilder
>> function method
>>
>> <T> Expression<T> function (String name, Class<T> type, Expression<?>...
>> args);
>>
>> with the expectation that we would add similar support to JPQL in this
>> release.
>>
>> The Criteria API currently doesn't specify whether we meant to support
>> aggregate/table functions via this mechanism as well as scalar
>> functions, although the syntax supports it. We need to discuss this,
>> and, assuming that we do support it, we need to clarify this point in
>> the spec.
>>
>> I would propose that we support both scalar and aggregate functions in
>> JPQL as well as in the criteria API.
>>
>> Here's a strawman syntax for JPQL to kick off the discussion
>>
>> FUNC(function_name, arg1, ..., argn)
>>
>> Function_name is a string that denotes the database function that is
>> to be invoked.
>>
>> Example:
>>
>> SELECT c
>> FROM Customer c
>> WHERE FUNC("hasGoodCredit", c.balance, c.creditLimit)
>>
>> The arguments must be suitable for the database function that is to be
>> invoked.
>>
>> The result of the function must be suitable for the invocation
>> context.
>>
>> The function may be a database-defined function or a user-defined
>> function.
>>
>> Opinions?
>>
>> thanks,
>>
>> -Linda