Hi Andrus,

On 10/06/2008, at 10:28 PM, Andrus Adamchik wrote:

Hi Lachlan, sorry for confusion on my part...

No problems...

As it turned out, there are actually 3 separate issues

* Serialization when running EJBQL with ROP (CAY-1072 - fixed)
* Converting lists of values to EJBQL Strings (CAY-1073 - fixed)

Excellent. Thanks.

* Converting non-string and non-numeric expression parameters to EJBQL (no Jira yet, I will pen one soon...).

In regards to the last one, per my second comment on CAY-1072, I totally agree with you that we need to handle this case. However we can't convert those to Strings. This is just not possible because (a) EJBQL syntax only supports literals for Strings, numerics, enums and booleans; (b) Cayenne fundamentally would not deal with things like Date[Time] to String and back conversion, as this is the functionality of the JDBC layer.

So the solution has to be elsewhere. What I was proposing (maybe there is a better one?) is this:

 Expression.toEJBQL(String rootId, Map parametersCallback);

Expression object would stick any parameters generated internally into 'parametersCallback' map. So that later you could pass it to EJBQLQuery.

Would that then be like this:
EJBQLQuery query; // assume exists
for (Map.Entry<String,Object> param : parametersCallback) {
        query.setParameter(param.getKey(), param.getValue());
}

Or would there still need to be special treatment given to dates and the like?

Note that this does not affect how you create your original Expression objects.

Does that sound reasonable?

Sounds good, sure (so far as mapping between cayenne expressions and EJBQL). I wonder, however, if the parameters callback would be more generally useful. i.e., if it would make sense to place all values in there and not just the ones that can't be stringified.

Would it also make sense to have a Cayenne based CountQuery?
e.g.,
CountQuery count = new CountQuery(SelectQuery);

with regards,
--

Lachlan Deck
[EMAIL PROTECTED]


with regards,
--

Lachlan Deck



Reply via email to