Return-Path: Mailing-List: contact turbine-torque-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list turbine-torque-dev@jakarta.apache.org Received: (qmail 28715 invoked by uid 97); 25 Jan 2003 16:47:49 -0000 Received: (qmail 28711 invoked by uid 98); 25 Jan 2003 16:47:48 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Received: (qmail 28671 invoked from network); 25 Jan 2003 16:47:46 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 25 Jan 2003 16:47:46 -0000 Received: (qmail 14230 invoked by uid 500); 25 Jan 2003 16:46:19 -0000 Received: (qmail 14223 invoked from network); 25 Jan 2003 16:46:19 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 25 Jan 2003 16:46:19 -0000 Received: (qmail 25055 invoked by uid 1609); 25 Jan 2003 16:46:18 -0000 Date: 25 Jan 2003 16:46:18 -0000 Message-ID: <20030125164618.25054.qmail@icarus.apache.org> From: quintonm@apache.org To: jakarta-turbine-torque-cvs@apache.org Subject: cvs commit: jakarta-turbine-torque/src/templates/om Peer.vm X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N quintonm 2003/01/25 08:46:18 Modified: src/templates/om Peer.vm Log: Covered the case of more than one row being selected. A TooManyRowsException will be thrown in this case. Revision Changes Path 1.51 +12 -5 jakarta-turbine-torque/src/templates/om/Peer.vm Index: Peer.vm =================================================================== RCS file: /home/cvs/jakarta-turbine-torque/src/templates/om/Peer.vm,v retrieving revision 1.50 retrieving revision 1.51 diff -u -r1.50 -r1.51 --- Peer.vm 25 Jan 2003 16:42:25 -0000 1.50 +++ Peer.vm 25 Jan 2003 16:46:18 -0000 1.51 @@ -985,9 +985,10 @@ * @throws TorqueException Any exceptions caught during processing will be * rethrown wrapped into a TorqueException. * @throws NoRowsException Primary key was not found in database. + * @throws TooManyRowsException Primary key was not found in database. */ public static $table.JavaName ${retrieveMethod}($pk.JavaNative pk) - throws TorqueException, NoRowsException + throws TorqueException, NoRowsException, TooManyRowsException { return ${retrieveMethod}(SimpleKey.keyFor(pk)); } @@ -1000,9 +1001,10 @@ * @throws TorqueException Any exceptions caught during processing will be * rethrown wrapped into a TorqueException. * @throws NoRowsException Primary key was not found in database. + * @throws TooManyRowsException Primary key was not found in database. */ public static $table.JavaName ${retrieveMethod}(ObjectKey pk) - throws TorqueException, NoRowsException + throws TorqueException, NoRowsException, TooManyRowsException { Connection db = null; $table.JavaName retVal = null; @@ -1026,15 +1028,20 @@ * @throws TorqueException Any exceptions caught during processing will be * rethrown wrapped into a TorqueException. * @throws NoRowsException Primary key was not found in database. + * @throws TooManyRowsException Primary key was not found in database. */ public static $table.JavaName ${retrieveMethod}(ObjectKey pk, Connection con) - throws TorqueException, NoRowsException + throws TorqueException, NoRowsException, TooManyRowsException { Criteria criteria = buildCriteria(pk); List v = doSelect(criteria, con); - if (v.size() != 1) + if (v.size() == 0) { - throw new NoRowsException("Failed to select one and only one row."); + throw new NoRowsException("Failed to select a row."); + } + else if (v.size() > 1) + { + throw new TooManyRowsException("Failed to select only one row."); } else {