Thanks Michael, SelectTranslator was exactly what I needed.

Cheers,
- hugi

// Hugi Thordarson
// http://www.loftfar.is/ <http://www.loftfar.is/>
// s. 895-6688



> On 19. maí 2015, at 15:36, Michael Gentry <mgen...@masslight.net> wrote:
> 
> Hi Hugi,
> 
> Perhaps this can help you:
> 
> https://github.com/mrg/cbe/tree/master/FetchingObjects/Aggregates/src/main/java/cbe/fetching/utilities
> 
> AggregateUtils uses AggregateTranslator to construct the SQL for a query
> (getting the SQL from Cayenne) and then manipulates it to run a COUNT(*) or
> SUM(...) type function based upon your original SelectQuery.  Especially
> look at AggregateTranslator.createSqlString().
> 
> The example code using it might also help you:
> 
> https://github.com/mrg/cbe/blob/master/FetchingObjects/Aggregates/src/main/java/cbe/fetching/Aggregates.java
> 
> mrg
> 
> 
> On Tue, May 19, 2015 at 11:21 AM, Hugi Thordarson <h...@karlmenn.is> wrote:
> 
>> Hi all.
>> 
>> I’m creating a little utility method to emulate functionality from EOF,
>> i.e. to allow me to fetch distinct values for specified columns. This is
>> what I have so far:
>> 
>> https://gist.github.com/hugith/05de4ad2f3d6f2cdc16a <
>> https://gist.github.com/hugith/05de4ad2f3d6f2cdc16a>
>> 
>> However, I would like to be able to provide an expression to the query.
>> Does Cayenne have something to generate the SQL from an expression for me?
>> 
>> Am I perhaps going totally wrong about this?
>> 
>> Cheers,
>> - hugi

Reply via email to