On Dec 21, 2007, at 2:38 PM, Aristedes Maniatis wrote:
> Also, is reversing the syntax an interesting idea if this change is
> going to be made?
>
> List<Artists> result = query.getResult(Artist.class, context);
> List<Artists> result = query.getResultAsDataRows(Artist.class,
> context);
>
> Maybe that will just confuse people. Otherwise,
>
> context.getResultAsDataRows(Artist.class, query)
> context.getResult(Artist.class, query)
The wrapper idea (SelectBuilder) is sort of along the lines of
reversing the API that you suggested. But let me comment on why I am
not a fan of adding new ways to run a query to the ObjectContext. When
implementing ROP and nested contexts I found out that having so many
"redundant" or "utility" methods in a context object makes it
extremely hard to implement multi-layer contexts. So I'd prefer that
we keep ObjectContext API as lean as possible, and pass all query
parameters in the query object itself.
On the other hand what is seen as fluff by the framework developers,
is in fact what makes things smooth for the end users. So we have to
address both conflicting concerns. In such situation, I feel that
having special end-user API separate from the stack abstraction of
ObjectContext is the least invasive solution.
DataObjectUtils is one example of that and it turned to be a big
success... So what I am suggesting is to expand on that and provide an
even more powerful and terse way to get data in Cayenne. That'll be
another layer on top of what we have, the one that doesn't have API
constraints of the main stack building blocks.
Andrus
This archive was generated by hypermail 2.0.0 : Fri Dec 21 2007 - 10:53:46 EST