James,
> Do you mean computed on the database, or computed in Java?
>
I mean "computed in Java".
> JPQL is translated into SQL, so performing Java operations may be difficult.
>
But the JPA specificiation says that getter methods can be used as
state-field names.
> You can use some database functions in JPQL, but these are fairly limited
> and do not support user defined functions, nor does JPQL allow functions in
> the select clause I believe.
>
Unfortunately, I can only use aggregates in the SELECT clause, but not
CONCAT and others, which is actually what I need.
> see,
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=219814
> (if this is what you need please vote for the bug)
>
I am sorry, but I am not seeking for vendor specific features but solely
for features allowed by the spec.
> TopLink/EclipseLink internally uses QueryKeys defined in the
> TopLink/EclipseLink ClassDescriptor to process JPQL attributes. Potentially
> you could define a QueryKey in your descriptor for x. I think it would be
> useful to have extended query keys that can do computations, feel free to
> log an enhancement for this.
>
Thanks
Markus
>
>
> Markus KARG-3 wrote:
>
>> Is there a way to use "computed properties" (transient getter methods) in
>> QL?
>>
>> What I want to do is to have a method "String getX() {return "some
>> computed value";}" to be called for each entity instance fetched by
>> "SELECT o.x FROM MyEntity o".
>>
>> Is that possible?
>>
>> Thanks
>>
>> Markus
>>
>>
>
>
> -----
> ---
> http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland
> http://www.eclipse.org/eclipselink/
> EclipseLink , http://www.oracle.com/technology/products/ias/toplink/
> TopLink
> Wiki: http://wiki.eclipse.org/EclipseLink EclipseLink ,
> http://wiki.oracle.com/page/TopLink TopLink
> Forums: http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink ,
> http://www.nabble.com/EclipseLink-f26430.html EclipseLink
> Book: http://en.wikibooks.org/wiki/Java_Persistence Java Persistence
>
--
http://www.xing.com/go/invita/58469