Return-Path: X-Original-To: apmail-cayenne-dev-archive@www.apache.org Delivered-To: apmail-cayenne-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 06EBD17CE9 for ; Tue, 7 Apr 2015 14:40:55 +0000 (UTC) Received: (qmail 41952 invoked by uid 500); 7 Apr 2015 14:40:39 -0000 Delivered-To: apmail-cayenne-dev-archive@cayenne.apache.org Received: (qmail 41941 invoked by uid 500); 7 Apr 2015 14:40:39 -0000 Mailing-List: contact dev-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cayenne.apache.org Delivered-To: mailing list dev@cayenne.apache.org Received: (qmail 41930 invoked by uid 99); 7 Apr 2015 14:40:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Apr 2015 14:40:38 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW X-Spam-Check-By: apache.org Received-SPF: error (nike.apache.org: local policy) Received: from [209.85.212.172] (HELO mail-wi0-f172.google.com) (209.85.212.172) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Apr 2015 14:40:14 +0000 Received: by widdi4 with SMTP id di4so20147625wid.0 for ; Tue, 07 Apr 2015 07:39:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=4Bv69bjBnrGXkyLv4O9zm6R2ecpWsmtiuT4Cg1FK8Ms=; b=eYQRG45oEcDP8cpwfixcNCqNYVmZ3mtjYX7iHEYB/97jUkF/IHc7OBHFK6vZVHATJH sIVe0o5Wk1dTNuSkrkTqkJ4wfAGN6Es0KOQ7spv1V0F4j3fRXhtZajOkBXi/dYO284dC qMZfFVvnXlgC37DMZhRQH07XmOasf21Q/S8iCrVtUL4dEaCP8d2mQc7xT0lwSqrcwpbF T/ZImNcp56edlkqRDCxl+I1SFMXQX5CjKKjLOQrh71/D3QdjuDmBKucIWfjfGps+fVrE jwYRJajsKkhb2raFkBXxogogFQoOCQURHFuSmckIAo52aF2QcO0YnyevT6+XoPkf2CmB M4WA== X-Gm-Message-State: ALoCoQmO7bzWruC9z+WKUkjBZpOjtG3MBBhWAKjM4AO9xXiAmC6uHz/spop7Hn+o44/c+NsVTS0S X-Received: by 10.194.157.39 with SMTP id wj7mr40781746wjb.57.1428417592511; Tue, 07 Apr 2015 07:39:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.150.139 with HTTP; Tue, 7 Apr 2015 07:39:32 -0700 (PDT) In-Reply-To: <9659852B-5274-4875-AA77-E0184BA83B1A@objectstyle.org> References: <9659852B-5274-4875-AA77-E0184BA83B1A@objectstyle.org> From: Michael Gentry Date: Tue, 7 Apr 2015 10:39:32 -0400 Message-ID: Subject: Re: New features in Select API To: Cayenne Developers Content-Type: multipart/alternative; boundary=089e013c6b5a31666e0513236363 X-Virus-Checked: Checked by ClamAV on apache.org --089e013c6b5a31666e0513236363 Content-Type: text/plain; charset=UTF-8 Hi Andrus! On Tue, Apr 7, 2015 at 9:54 AM, Andrus Adamchik wrote: > Hey Mike, > > > > On Apr 7, 2015, at 4:43 PM, Michael Gentry > 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 objects = ObjectSelect.query(T.class).select(context); > 2. List 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 --089e013c6b5a31666e0513236363--