cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Lindesay (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CAY-1932) Improved Handling for Scalar Parameters Converting Expressions to EJBQL
Date Sun, 11 May 2014 10:07:14 GMT
Andrew Lindesay created CAY-1932:
------------------------------------

             Summary: Improved Handling for Scalar Parameters Converting Expressions to EJBQL
                 Key: CAY-1932
                 URL: https://issues.apache.org/jira/browse/CAY-1932
             Project: Cayenne
          Issue Type: Improvement
          Components: Core Library
    Affects Versions: 3.2M1
            Reporter: Andrew Lindesay


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
(v6.2#6252)

Mime
View raw message