cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aristedes Maniatis <...@maniatis.org>
Subject Re: ColumnSelect API + Persistent objects
Date Mon, 13 Mar 2017 10:46:33 GMT
On 13/3/17 7:26pm, Andrus Adamchik wrote:
> 
> Yep. A typical use case for intermixing DataObjects and scalars in the result is this:
[<artist>, <count_of_paintings>] that gives us each object's to-many counts without
resolving to-many relationships. What I am unsure though is whether [<artist_name>,
<painting>] result is of any use to anyone.


Just a wild thought, but would this syntax be helpful...

List<Object[]> result = ObjectSelect.query(Artist.class)
     .addColumns(Artist.PAINTING_COUNT)
     .select(context);

So then we are adding more columns to the existing DataObject query rather than having to
define the DataObjects as properties in themselves. The syntax above might be simpler to understand
and write.


>> Are users going to be confused that the ObjEntities are bound to a context and editable/committable,
but the raw columns are not?
> I am not concerned about this. I think everyone should understand that only DataObjects
can be committed. Any other representations is non-updateable data.

Perhaps, but this is the first time these two things are inter-mingled in one list. And I've
always thought of contexts as 'owning' the items within the result list. But as long as users
are clear that contexts control the elements in the result and not the list itself, then I'm
probably overthinking it.


Ari



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

Mime
View raw message