cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Gentry <mgen...@masslight.net>
Subject Re: New features in Select API
Date Tue, 07 Apr 2015 14:39:32 GMT
Hi Andrus!

On Tue, Apr 7, 2015 at 9:54 AM, Andrus Adamchik <andrus@objectstyle.org>
wrote:

> 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);


Yes, but I was just trying to suggest something that mapped into
Select.java as well.


> 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?


Sort of, but I still found it confusing.  Perhaps something like:

    Essentially the equivalent of "ObjectContext.selectOne(Select)".

Thanks,

mrg

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message