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 6C67699F7 for ; Sat, 25 May 2013 07:34:11 +0000 (UTC) Received: (qmail 52427 invoked by uid 500); 25 May 2013 07:34:11 -0000 Delivered-To: apmail-cayenne-dev-archive@cayenne.apache.org Received: (qmail 52264 invoked by uid 500); 25 May 2013 07:34:07 -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 52120 invoked by uid 99); 25 May 2013 07:34:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 25 May 2013 07:34:00 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests= X-Spam-Check-By: apache.org Received-SPF: error (nike.apache.org: local policy) Received: from [59.167.240.32] (HELO fish.ish.com.au) (59.167.240.32) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 25 May 2013 07:33:54 +0000 Received: from [10.242.2.10] (port=51695 helo=Aris-MacBook-Pro-3.local) by fish.ish.com.au with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.76) (envelope-from ) id 1Ug8yM-00078v-11 for dev@cayenne.apache.org; Sat, 25 May 2013 17:33:03 +1000 X-CTCH-RefID: str=0001.0A150203.51A0692E.0212,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 Message-ID: <51A0692F.6030301@maniatis.org> Date: Sat, 25 May 2013 17:33:03 +1000 From: Aristedes Maniatis User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:22.0) Gecko/20100101 Thunderbird/22.0 MIME-Version: 1.0 To: dev@cayenne.apache.org Subject: Re: SQLSelect: Getting =?windows-1252?Q?fluent=85_WDYT=3F?= References: <1B9775F4-3039-4390-B647-408192678243@objectstyle.org> In-Reply-To: <1B9775F4-3039-4390-B647-408192678243@objectstyle.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On 25/05/13 1:45am, Andrus Adamchik wrote: > I can think of other methods for building SQL chunks based on Cayenne mapping, such as "allColumns()", etc. > > What do you think? Also method naming criticism is accepted. E.g. I am not sure that changing "setPageSize()" to "pageSize()" was such a great idea. I think that in a fluent api, removing "set" before every method is clearer. Then you will have: Artists artists = SQLSelect.query(Artist.class, "SELECT * FROM Artists WHERE name = $name").bind("name", "fred").pageSize(10).cacheGroups("main").select() However I am confused by columnNameCaps(). This seems to be something you'd want to set in the data model rather than per query. Or could Cayenne just perform a case insensitive match to the db model and then adjust the case as needed, all without specifying anything. Also, does it make sense to allow the bindings within the query method as an option: SQLSelect.query(Artist.class, "SELECT * FROM Artists WHERE name = $name", "name", "fred") That's a bit like printf style calls (although it references replacements by position rather than name). Would it be possible to write aggregate queries: int count = SQLSelect.scalar(Artist.class, "SELECT COUNT(*) FROM Artists WHERE name = $name").bind("name", "fred").value() Ari -- --------------------------> Aristedes Maniatis GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A