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 554 invoked by uid 98); 23 Jan 2003 15:02:16 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Received: (qmail 511 invoked from network); 23 Jan 2003 15:02:14 -0000 Received: from unknown (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 23 Jan 2003 15:02:14 -0000 Received: (qmail 95158 invoked by uid 500); 23 Jan 2003 15:00:44 -0000 Received: (qmail 95127 invoked from network); 23 Jan 2003 15:00:44 -0000 Received: from mail.bynum.com (HELO blr02.bynum.com) (64.79.231.74) by 208.185.179.12.available.above.net with SMTP; 23 Jan 2003 15:00:44 -0000 X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: [RFC] Changing retrieveByPK Date: Thu, 23 Jan 2003 09:00:12 -0600 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [RFC] Changing retrieveByPK Thread-Index: AcLC3uPdMReJwTpqT+q1m9+3pCz8cAAER/yw From: "Quinton McCombs" To: "Turbine Torque Developers List" , X-Spam-Rating: 208.185.179.12.available.above.net 1.6.2 0/1000/N I would suggest subclassing TorqueException. Perhaps TooManyRows and NoRows could subclass TorqueException. The superclass would only be thrown for general exceptions. This would prevent any existing code from breaking.... > -----Original Message----- > From: Henning P. Schmiedehausen [mailto:hps@intermeta.de]=20 > Sent: Thursday, January 23, 2003 6:57 AM > To: turbine-torque-dev@jakarta.apache.org > Subject: [RFC] Changing retrieveByPK >=20 >=20 > Hi, >=20 > I have the following problem: >=20 > In Peer.vm there is the following code: >=20 > --- cut --- > List v =3D doSelect(criteria, con); > if (v.size() !=3D 1) > { > throw new TorqueException("Failed to select one=20 > and only one row."); > } > else > { > return ($table.JavaName)v.get(0); > } > --- cut --- >=20 > I'd like to distinguish between "no such object found" and=20 > "an error occured". >=20 > How about changing this to=20 >=20 > --- cut --- > List v =3D doSelect(criteria, con); > switch (v.size()) > { > case 0: > throw ... some other exception >=20 > case 1: > break; >=20 > default: > throw new TorqueException("Failed to select=20 > one and only one row."); > } > return ($table.JavaName)v.get(0); > --- cut --- >=20 > to make this possible. >=20 > Regards > Henning >=20 > --=20 > Dipl.-Inf. (Univ.) Henning P. Schmiedehausen --=20 > Geschaeftsfuehrer > INTERMETA - Gesellschaft fuer Mehrwertdienste mbH hps@intermeta.de >=20 > Am Schwabachgrund 22 Fon.: 09131 / 50654-0 info@intermeta.de > D-91054 Buckenhof Fax.: 09131 / 50654-20 =20 >=20 > -- > To unsubscribe, e-mail: =20 > unsubscribe@jakarta.apache.org> >=20 > For additional commands,=20 > e-mail: >=20 >=20