Return-Path: X-Original-To: apmail-db-torque-dev-archive@www.apache.org Delivered-To: apmail-db-torque-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 74C3D9FB6 for ; Wed, 9 May 2012 13:36:11 +0000 (UTC) Received: (qmail 72019 invoked by uid 500); 9 May 2012 13:36:11 -0000 Delivered-To: apmail-db-torque-dev-archive@db.apache.org Received: (qmail 71997 invoked by uid 500); 9 May 2012 13:36:11 -0000 Mailing-List: contact torque-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Apache Torque Developers List" Reply-To: "Apache Torque Developers List" Delivered-To: mailing list torque-dev@db.apache.org Received: (qmail 71989 invoked by uid 99); 9 May 2012 13:36:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2012 13:36:11 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2012 13:36:09 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 36AD643BEF8 for ; Wed, 9 May 2012 13:35:48 +0000 (UTC) Date: Wed, 9 May 2012 13:35:48 +0000 (UTC) From: "Thomas Fox (JIRA)" To: torque-dev@db.apache.org Message-ID: <434098156.44228.1336570548225.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1200192585.43793.1336562990338.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Resolved] (TORQUE-200) Generate methods in Peer classes to retrieve a single object from a table MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/TORQUE-200?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Thomas Fox resolved TORQUE-200. ------------------------------- Resolution: Fixed Fix Version/s: 4.0 The generation of the new methods can be suppressed by setting the property torque.om.addSelectSingleRecordMethods = false in the generator options. > Generate methods in Peer classes to retrieve a single object from a table > ------------------------------------------------------------------------- > > Key: TORQUE-200 > URL: https://issues.apache.org/jira/browse/TORQUE-200 > Project: Torque > Issue Type: Improvement > Components: Templates > Reporter: Thomas Fox > Assignee: Thomas Fox > Fix For: 4.0 > > > Often, one knows that a database query will return at most a single object. > To get that object, the following code is needed: > List bookList = BookPeer.doSelect(criteria); > Book book = null; > if (bookList.size > 1) > { > throw new TooManyRowsException("..."); > } > if (!bookList.isEmpty()) > { > book = bookList.get(0); > } > There should be methods named doSelectSingleRecord(...) generated in the Peer class which contains teh above code. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org For additional commands, e-mail: torque-dev-help@db.apache.org