cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nikita Timofeev <ntimof...@objectstyle.com>
Subject Re: ColumnSelect API + Persistent objects
Date Thu, 16 Mar 2017 08:14:20 GMT
On Mon, Mar 13, 2017 at 3:05 PM, Aristedes Maniatis <ari@maniatis.org> wrote:
> On 13/3/17 9:53pm, Andrus Adamchik wrote:
>>
>>> On Mar 13, 2017, at 1:46 PM, Aristedes Maniatis <ari@maniatis.org> wrote:
>>>
>>>
>>> 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.
>>
>> So "addColumns" vs "columns"? IIRC we tried something similar with orderings (override
all orderings vs add to the existing orderings), and that confused everybody (including me
as the author), so that was undone between the milestones.
>
>
> Except in this case it is very different result since with this syntax you get the mixed
columns/DataObject results and avoid needing to create properties for 'self' or some other
confusing construct.
>

I think we can add Property<EntityType> SELF to default cgen
templates, then everything will be pretty simple:

    ObjectSelect
        .columnQuery(Artist.class, Artist.SELF, Artist.PAINTING_ARRAY.count())
        .select(context);


-- 
Best regards,
Nikita Timofeev

Mime
View raw message