Hi Marc,

Upgrading to 4.2 final is probably a good idea regardless of the aggregation 
function use :) 

Regarding your question. There are a few ways to approach it (and I wish we 
could abstract it a bit better) :

1. Instead of someProperty.function(..), try to create a subclass of 
ASTAggregateFunctionCall. E.g. you can follow an expample of ASTMin.
2. You can customize the generated SQL via a custom SQLTreeProcessor (something 
that was mentioned a few months ago in a different context) 

I am really curious if #1 works, and if it doesn't, be happy to provide 
pointers on #2.

Thanks,
Andrus


> On Jan 4, 2024, at 10:12 AM, Mark Stobbe <markstobb...@gmail.com> wrote:
> 
> Hi all,
> 
> Does anyone know how to use "array_agg" as a function? I am using Cayenne
> 4.2.M3, but it's ok if I need to upgrade to a later version.
> 
> I was trying with someProperty.function("array_agg", List.class)
> but it will not automatically group by all the other fields since it
> doesn't recognise it as a ASTAggregateFunctionCall
> 
> Mark

Reply via email to