Re: ColumnSelect API + Persistent objects

2017-03-21 Thread Nikita Timofeev
Here is latest version that already committed and can be tested: ObjectSelect .columnQuery(Artist.class, Property.createSelf(Artist.class), // query root Artist.PAINTING_ARRAY.dot(Painting.GALLERY), // toOne relationship Artist.PAINTING_ARRAY.f

Re: ColumnSelect API + Persistent objects

2017-03-16 Thread Andrus Adamchik
> On Mar 16, 2017, at 11:14 AM, Nikita Timofeev > wrote: > > On Mon, Mar 13, 2017 at 3:05 PM, Aristedes Maniatis wrote: >> 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

Re: ColumnSelect API + Persistent objects

2017-03-16 Thread Nikita Timofeev
On Mon, Mar 13, 2017 at 3:05 PM, Aristedes Maniatis wrote: > 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) >>>

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

Re: ColumnSelect API + Persistent objects

2017-03-12 Thread Andrus Adamchik
>>> >>> 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 using Prefetch (or even selecting related >> entitie

Re: ColumnSelect API + Persistent objects

2017-03-12 Thread Andrus Adamchik
> On Mar 9, 2017, at 10:17 AM, Nikita Timofeev > wrote: > > On Wed, Mar 8, 2017 at 3:48 AM, Aristedes Maniatis wrote: >> On 7/3/17 11:12pm, Nikita Timofeev wrote: >>> 2) Add new factory methods in Property class: >>> >>> Property createSelf(Class type); >> >> Why wouldn't we just use nor

Re: ColumnSelect API + Persistent objects

2017-03-08 Thread Nikita Timofeev
On Wed, Mar 8, 2017 at 3:48 AM, Aristedes Maniatis wrote: > On 7/3/17 11:12pm, Nikita Timofeev wrote: >> 2) Add new factory methods in Property class: >> >> Property createSelf(Class type); > > Why wouldn't we just use normal constructors? > > a = new Property(Artist.class); That's because c

Re: ColumnSelect API + Persistent objects

2017-03-07 Thread Aristedes Maniatis
On 7/3/17 11:12pm, Nikita Timofeev wrote: > 2) Add new factory methods in Property class: > > Property createSelf(Class type); Why wouldn't we just use normal constructors? a = new Property(Artist.class); > Property createForRelationship( >Property property, Class