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 7363217A26 for ; Mon, 6 Oct 2014 12:01:13 +0000 (UTC) Received: (qmail 68170 invoked by uid 500); 6 Oct 2014 12:01:13 -0000 Delivered-To: apmail-cayenne-dev-archive@cayenne.apache.org Received: (qmail 68142 invoked by uid 500); 6 Oct 2014 12:01:13 -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 68131 invoked by uid 99); 6 Oct 2014 12:01:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Oct 2014 12:01:12 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [202.161.115.54] (HELO fish.ish.com.au) (202.161.115.54) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Oct 2014 12:00:45 +0000 Received: from ip-211.ish.com.au ([203.29.62.211]:11234 helo=ish.com.au) by fish.ish.com.au with esmtp (Exim 4.76) (envelope-from ) id 1Xb6xw-00069W-1m for dev@cayenne.apache.org; Mon, 06 Oct 2014 23:00:37 +1100 Received: from [10.242.2.10] (HELO Aris-MacBook-Pro-3.local) by ish.com.au (CommuniGate Pro SMTP 6.0.9) with ESMTPS id 17763049 for dev@cayenne.apache.org; Mon, 06 Oct 2014 23:00:36 +1100 Message-ID: <5432846B.4050607@maniatis.org> Date: Mon, 06 Oct 2014 23:00:43 +1100 From: Aristedes Maniatis User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:33.0) Gecko/20100101 Thunderbird/33.0 MIME-Version: 1.0 To: dev@cayenne.apache.org Subject: Re: Chainable SelectQuery References: <4C8D7FB8-12BC-402E-97EE-31F2F02064B3@objectstyle.org> In-Reply-To: <4C8D7FB8-12BC-402E-97EE-31F2F02064B3@objectstyle.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On 6/10/2014 2:10am, Andrus Adamchik wrote: > // a single chain from query to object list > List paintings2 = SelectQuery.query(Painting.class, qualifier2).select(context); Since we already have a constructor with the appropriate arguments, why not go for this as the recommended approach: List paintings2 = new SelectQuery(Painting.class, qualifier2).select(context); I'm not really sure it makes a difference either way, but just throwing it out there. They will both work, but the constructor doesn't have generics yet. > // static use of "exp" (former "Expression.fromString") > // immediate parameter binding > Expression qualifier3 = exp("artist.dateOfBirth < $date", "date", c.getTime()); Can't we parse without any ambiguity: exp("artist.dateOfBirth < $date", c.getTime()); > // static use of 'or' seems cleaner than chaining expressions with 'exp.orExp(..)' > List paintings4 = SelectQuery.query(Painting.class, or(qualifier2, qualifier3)).select(context); Let's see how this plays out with longer queries: List paintings4 = SelectQuery.query(Painting.class, and(or(qualifier2, qualifier3), qualifier4)).select(context); That looks a bit like reverse Polish notation. To my mind, this approach is clearer: List paintings4 = new SelectQuery(Painting.class).or(qualifier1).or(qualifier3).and(qualifier4).select(context); Am I misunderstanding the different approaches to this? It appears both are valid with the patch you are proposing. Also, I think the use of the words "qualifier" and "expression" are confusing. We use them interchangeably without much reason. Can we pick one and stick to it? Ari -- --------------------------> Aristedes Maniatis GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A