cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: New features in Select API
Date Tue, 07 Apr 2015 13:54:29 GMT
Hey Mike,


> On Apr 7, 2015, at 4:43 PM, Michael Gentry <mgentry@masslight.net> wrote:
> 
> Select.select(ObjectContext context, int size);
> 
> Then selectFirst would just call it with a size = 1.  This would give you
> an easy way to support fetching the top 5 (or 10 or any other number)
> newest/hottest/etc news articles (to use your example).  

FWIW, an equivalent api for size > 1 API would be:

ObjectSelect.query(..).limit(5).select(context);

> Also, maybe I'm misreading the JavaDocs, but for Select.selectOne, it says:
> Essentially the inversion of "ObjectContext.selectOne(Select)".
> 
> I don't think inversion is the correct word, since it means opposite, and
> they aren't opposites.  A couple others use the word inversion, too, when I
> don't think that is what is meant.

I think this doc was copied from ObjectSelect.selectOne, etc. Here inversion means "call order
inversion". I.e. you get the same result, but perform the invocation in a different (opposite)
way:

1. List<T> objects = ObjectSelect.query(T.class).select(context);
2. List<T> objects = context.select(ObjectSelect.query(T.class));

Does it make sense with such explanation?

Andrus
Mime
View raw message