Re: ColumnSelect API + Persistent objects

2017-03-13 Thread Aristedes Maniatis
On 13/3/17 9:53pm, Andrus Adamchik wrote: > >> On Mar 13, 2017, at 1:46 PM, Aristedes Maniatis wrote: >> >> >> Just a wild thought, but would this syntax be helpful... >> >> List result = ObjectSelect.query(Artist.class) >> .addColumns(Artist.PAINTING_COUNT) >> .select(context); >> >> So

Re: ColumnSelect API + Persistent objects

2017-03-13 Thread Andrus Adamchik
> On Mar 13, 2017, at 1:46 PM, Aristedes Maniatis wrote: > > > Just a wild thought, but would this syntax be helpful... > > List result = ObjectSelect.query(Artist.class) > .addColumns(Artist.PAINTING_COUNT) > .select(context); > > So then we are adding more columns to the existing Da

Re: ColumnSelect API + Persistent objects

2017-03-13 Thread Aristedes Maniatis
On 13/3/17 7:26pm, Andrus Adamchik wrote: > > Yep. A typical use case for intermixing DataObjects and scalars in the result > is this: [, ] that gives us each object's to-many > counts without resolving to-many relationships. What I am unsure though is > whether [, ] result is of any use to any

Re: ColumnSelect API + Persistent objects

2017-03-13 Thread Nikita Timofeev
> > What is the output of this: > > result = ObjectSelect.query(Artist.class) >.columns(createSelf(Artist.class)) >.select(context); > > Is that the same as > > result = ObjectSelect.query(Artist.class) >.select(context); > > would the generated SQL be the same? > Small com

Re: ColumnSelect API + Persistent objects

2017-03-13 Thread Andrus Adamchik
> Oh, I get it now. You are suggesting in option (2) that Cayenne creates a > CROSS JOIN in sql. Actually not a CROSS join. It will be a regular INNER JOIN based on relationship from the query root. JPA spec defines CROSS join operations. We don't (yet?). > Sometimes you want to fetch specific

Re: ColumnSelect API + Persistent objects

2017-03-13 Thread Aristedes Maniatis
On 13/3/17 5:57pm, Andrus Adamchik wrote: > List result = ObjectSelect.query(Artist.class) .columns(Artist.ARTIST_NAME, Artist.PAINTING_ARRAY) .select(context); > > >>> For me it's not clear when do we need direct List result for toMany >>> relationship instead of