The concern with allowing "inline" function naming is a lack of
available validation of predefined functions (AVG, SUM). A white list
could be setup but that seems like an unnecessary burden on the user.
There should be no reason to require the " marks though and simply have
"WHERE FUNC(hasGoodCredit, c.balance, c.creditLimit)"
Emmanuel Bernard wrote:
> Let me first say that I think it is a good feature.
>
> I was exchanging with a few colleagues and we are a bit chagrined to see the use of this syntax:
> - the syntax is more verbose than the corresponding SQL
> - it is also less readable
>
> how about we use a pass through approach and allow a more readable approach:
>
> Current proposal:
> "WHERE FUNC("hasGoodCredit", c.balance, c.creditLimit)"
>
> Alternative proposal
> "WHERE hasGoodCredit(c.balance, c.creditLimit)"
>
> We could use different approach to detect that it is indeed a method:
> - let go everything in the form of foo(...) when we don't know "foo"
> - use a white list approach and ask users to declare the list of DB specific methods they wish to use
> - let providers offer most used DB specific methods out of the box and still offer method #2
>
> I would also like to stress that while we have decided not to go for it in JPA 2, I proposed a more type-safe method to call functions in the Criteria API. So
> <T> Expression<T> function (String name, Class<T> type, Expression<?>... args);
> is not necessary the final evolution of this approach.
>
> Emmanuel
>
> NB Note that the current proposal also requires the use of " which means in Java that the string would look like String where = "WHERE FUNC(\"hasGoodCredit\", c.balance, c.creditLimit)"
>
>
> On 10 mars 2011, at 19:22, Linda DeMichiel wrote:
>
>
>> OK,
>>
>> What I'm hearing is
>>
>> 1) this is a good feature
>>
>> 2) use the keyword FUNCTION instead of FUNC
>>
>> 3) support both scalar and aggregate functions.
>>
>> If any of you disagree with any of these points, please post now,
>> otherwise I will proceed to write up more formally and add to the spec.
>>
>> thanks,
>>
>> -Linda
>>
>>
>> On 3/10/2011 9:01 AM, Rainer Kwesi Schweigkoffer wrote:
>>
>>> Werner Keil, am 10 Mar 2011 hast Du um 20:55 zum Thema "[jsr338-experts] Re: JPQL function invocation" geschrieben :
>>>
>>>> +1
>>>>
>>>> In a time of IDE-support, whether it's Eclipse, NetBeans or IntelliJ, too much abbrevation sounds no longer reasonable.
>>>> FUNCTION is more self-descriptive.
>>>>
>>> Me, I'd also prefer FUNCTION over FUNC, and, yes, we should support both scalar and aggregate functions spanning both database-defined and user-defined functions (I am assuming here that user-dfined means 'defined by the user on the database').
>>>
>> Yes, that was my intent.
>>
>>
>>> Best regards
>>> Rainer
>>> ---
>>> Rainer Schweigkoffer SAP AG Walldorf
>>> Business Solution & Technology TD Core JS&I
>>> Technology Development Dietmar-Hopp-Allee 16
>>> Java Server Core D-69190 Walldorf
>>> JEE Implementation Group phone: +49 6227 7 45305
>>> Building 3, I.3.14 fax: +49 6227 7 821177
>>> rainer.schweigkoffer_at_sap.com
>>> Sitz der Gesellschaft/Registered Office: Walldorf, Germany
>>> Vorstand/SAP Executive Board: Werner Brandt, Angelika Dammann,
>>> Bill McDermott (Co-CEO), Gerhard Oswald, Vishal Sikka,
>>> Jim Hagemann Snabe (Co-CEO)
>>> Vorsitzender des Aufsichtsrats/Chairperson of the SAP Supervisory Board: Hasso Plattner
>>> Registergericht/Commercial Register Mannheim No HRB 350269
>>> Diese E-Mail kann Betriebs- oder Geschaeftsgeheimnisse oder sonstige
>>> vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtuemlich erhalten haben, ist Ihnen eine Verwertung des Inhalts, eine Vervielfaeltigung oder Weitergabe der E-Mail ausdruecklich untersagt. Bitte benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen Dank.
>>> This e-mail may contain trade secrets or privileged, undisclosed, or
>>> otherwise confidential information. If you have received this e-mail in error, you are hereby notified that any review, copying, or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal. Thank you for your cooperation.
>>>
>
>