cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aristedes Maniatis <>
Subject Re: API for aggregate and non aggregate SQL functions
Date Tue, 10 Jan 2017 02:20:57 GMT
On 9/1/17 8:45pm, Nikita Timofeev wrote:
> ObjectSelect.query(Artist.class)
>      .columns(Artist.ARTIST_NAME, artistCount)
>      .having("a%"))
>      .or( // this goes to having
>      .select(context)

You are right. Since you can combine where() clauses with and/or and then do the same with
having(), it will be too hard for Cayenne to just look at some expression and pull them apart
into the right WHERE and HAVING sql components.

I forsee this will be a very common way to screw up your query. It seems that some databases
treat HAVING just like WHERE if there are no aggregates [1] but I think that isn't the same
for all database engines. And HAVING might be slower if you could have used WHERE instead.



Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

View raw message