Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 19893 invoked from network); 22 Apr 2008 11:48:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Apr 2008 11:48:18 -0000 Received: (qmail 73276 invoked by uid 500); 22 Apr 2008 11:48:19 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 73266 invoked by uid 500); 22 Apr 2008 11:48:18 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 73255 invoked by uid 99); 22 Apr 2008 11:48:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Apr 2008 04:48:18 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of borut.bolcina@gmail.com designates 209.85.128.190 as permitted sender) Received: from [209.85.128.190] (HELO fk-out-0910.google.com) (209.85.128.190) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Apr 2008 11:47:35 +0000 Received: by fk-out-0910.google.com with SMTP id 18so3561400fks.4 for ; Tue, 22 Apr 2008 04:47:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=TVdHZLWPo+S3dpZ/07gO5UPkPxuTog7dxAfbmnC3E8w=; b=Lsnzwf50+xVUUI7fUFobfDUgAhzuwt8MYPib14oPEJqZbEg2L91wDrO7h40JwWRYNsRMz9vxFJv+hqxba+GNtcnDWqgB/d2MeGOwkyYuuJDVkKXHwugJMS3taYxxkuH1iqYAiMy6lqdmhdEuMXIUpo+0FWSy87L37qhAAjogMyA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=uNzm+5idGaazwV4U5RMUVbfF20qUb500v6xQiFVuAwFfzRnJJ7ESb57lWoRNjJL13nmQvyAQTXL9kuUbI9JorjG/Fij7VBBVWSgrvj1hn3HiJ3ZpBD/yntfGU6Ex5v4/jKCU1CG2EmET0exY0OcLobrLg/h+5nTc1MP4+9qf9aI= Received: by 10.82.182.1 with SMTP id e1mr187979buf.21.1208864867306; Tue, 22 Apr 2008 04:47:47 -0700 (PDT) Received: by 10.82.184.14 with HTTP; Tue, 22 Apr 2008 04:47:47 -0700 (PDT) Message-ID: Date: Tue, 22 Apr 2008 13:47:47 +0200 From: "=?UTF-8?Q?Borut_Bol=C4=8Dina?=" To: user@cayenne.apache.org Subject: Re: newbie question In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_16770_30414602.1208864867261" References: <3DE2F3E894A5AE4D8EC2B2E94603BEA689D093@NLNHC011PEX.ubsamericas.net> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_16770_30414602.1208864867261 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello Andrus, what is the elegant 3.0M3 Cayenne way to do select MAX? Thanks, Borut 2007/10/9 Andrus Adamchik : > Hi Jan, > > Looks like what you need is a SQLTemplate query: > > http://cayenne.apache.org/doc/sqltemplate-query.html > > Here is a mockup code example: > > SQLTemplate q = new SQLTemplate(SomeClass.class, "select MAX(id) from > table"); > q.setFetchingDataRows(true); > > Map row = (Map) DataObjectUtils.objectForQuery(q); > Number id = (Number) row.values().iterator().next(); > > (Cayenne 3.0 will be featuring more elegant API to achieve that, but still > the code above should work just as well) > > Andrus > ------=_Part_16770_30414602.1208864867261--