cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Lindesay (JIRA)" <>
Subject [jira] [Updated] (CAY-1932) Improved Handling for Scalar Parameters Converting Expressions to EJBQL
Date Wed, 14 May 2014 11:15:15 GMT


Andrew Lindesay updated CAY-1932:

    Attachment: CAY-1932_14may2014_extratypes.patch

Please find additional patch with support for those additional numeric types discussed on
the mailing list.  Note that I suspect there may be an issue with Long parameters used with
EJBQL, but that's not directly related to this ticket.

> Improved Handling for Scalar Parameters Converting Expressions to EJBQL
> -----------------------------------------------------------------------
>                 Key: CAY-1932
>                 URL:
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Core Library
>    Affects Versions: 3.2M1
>            Reporter: Andrew Lindesay
>             Fix For: 3.2.M2
>         Attachments: CAY-1932_11may2014.patch, CAY-1932_14may2014_extratypes.patch
> The "toEJBQL()" method on the Expression object works well for some cases, but fails
where parameter types are employed where there is no EJBQL literal that can be used to serialize
the object as a string in the resultant EJBQL string.
> An obvious case of this is the use of a Date object.  Take the example of a comparison
between an object path and a date parameter.  The current code is outputting _something_ like;
> {noformat}
> (a.something.createTimestamp > 25 Mar 2014 12:23:34)
> {noformat}
> This "toString" on the Date object does not generate valid EJBQL and as far as I am able
to ascertain, there is no timestamp literal in EJBQL.  For this reason, the "toEJBQL()" method
on Expression is able to generate broken EJBQL strings.
> My solution to this will be to keep the existing "toEJBQL()" method, but have that method
fail with a runtime exception if it encounters a situation in which it is not able to serialize
to EJBQL correctly.  Another method "toEJBQL(List<Object> parameterAccumulator)" will
be provided.  This new method will populate the parameter accumulator each time it encounters
a parameter that it is not able to express as a literal and instead it will use a positional
parameter in the EJBQL string.  The caller can then use the 'captured' parameters to feed
back into the EJBQLQuery object.

This message was sent by Atlassian JIRA

View raw message