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 1344C98F8 for ; Sat, 25 May 2013 11:11:29 +0000 (UTC) Received: (qmail 21544 invoked by uid 500); 25 May 2013 11:11:28 -0000 Delivered-To: apmail-cayenne-dev-archive@cayenne.apache.org Received: (qmail 21391 invoked by uid 500); 25 May 2013 11:11:27 -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 21342 invoked by uid 99); 25 May 2013 11:11:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 25 May 2013 11:11:25 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.78.103.231] (HELO vorsha.objectstyle.org) (208.78.103.231) by apache.org (qpsmtpd/0.29) with SMTP; Sat, 25 May 2013 11:11:21 +0000 Received: (qmail 26588 invoked from network); 25 May 2013 11:13:53 -0000 Received: from unknown (HELO ?IPv6:::1?) (127.0.0.1) by localhost with SMTP; 25 May 2013 11:13:53 -0000 Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) Subject: =?windows-1252?Q?Re=3A_SQLSelect=3A_Getting_fluent=85_WDYT=3F?= From: Andrus Adamchik In-Reply-To: <40BFB1AF-105E-497D-A081-3701F0EDD349@objectstyle.org> Date: Sat, 25 May 2013 14:10:59 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <20976683-BD97-443C-B986-1D89FB036F15@objectstyle.org> References: <1B9775F4-3039-4390-B647-408192678243@objectstyle.org> <51A0692F.6030301@maniatis.org> <40BFB1AF-105E-497D-A081-3701F0EDD349@objectstyle.org> To: dev@cayenne.apache.org X-Mailer: Apple Mail (2.1503) X-Virus-Checked: Checked by ClamAV on apache.org Just committed basic scalar API: int c =3D SQLSelect.scalarQuery(Integer.class, "") .append("SELECT COUNT(*) FROM ARTIST") .selectOne(context); List ids =3D SQLSelect.scalarQuery(Long.class, "SELECT ARTIST_ID = FROM ARTIST ORDER BY ARTIST_ID").select(context); and documented the remaining enhancements per CAY-1830. Andrus On May 25, 2013, at 1:39 PM, Andrus Adamchik = wrote: >=20 > On May 25, 2013, at 10:33 AM, Aristedes Maniatis = wrote: >=20 >=20 >> 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. >=20 > Guessing it in Cayenne would be ideal. The feature itself dates back = to SQLTemplate, but the new API is all about making things easier. The = goal of this feat is to be able to convert DataRow to object, so we = presumably know the entity involved and can make a good guess. >=20 >> Also, does it make sense to allow the bindings within the query = method as an option: >>=20 >> SQLSelect.query(Artist.class, "SELECT * FROM Artists WHERE name =3D = $name", "name", "fred") >>=20 >> That's a bit like printf style calls (although it references = replacements by position rather than name). >=20 > Yeah, I'd say we should start supporting positional parameters (and we = do in EJBQL, but not in SQLTemplate or Expression). Then it will work = with a vararg method. >=20 >=20 >> Would it be possible to write aggregate queries: >>=20 >> int count =3D SQLSelect.scalar(Artist.class, "SELECT COUNT(*) FROM = Artists WHERE name =3D $name").bind("name", "fred").value() >=20 > Good idea. It should be easy to do. >=20 > Andrus >=20 >=20