On Jun 11, 2008, at 3:26 AM, Lachlan Deck wrote:

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?

Yes - as simple as your example above. Nothing special to do about dates, etc.


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.

Possibly, especially for non-integer numerics, to avoid any possible fuzziness.

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

We've had extensive discussions abut "utility" queries in the past. I think we do need query-related utility classes/methods in some form. I am not sure there should be a standalone query for each one of them. Consider that there are also AVG, MAX, MIN, and other things that a user might want to select. But more generally making those types of queries easier to assemble and run is on the TODO list.

Andrus

Reply via email to