quintonm 2003/01/25 08:42:25
Modified: src/templates/om Peer.vm
Log:
retreiveByPk methods will now throw NoRowsException
instead of TorqueException when the primary key is
not found in the database. Note: The new exception
is a subclass of TorqueException so existing code will
not be affected.
Revision Changes Path
1.50 +7 -4 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.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- Peer.vm 8 Jan 2003 16:40:12 -0000 1.49
+++ Peer.vm 25 Jan 2003 16:42:25 -0000 1.50
@@ -984,9 +984,10 @@
* @param pk the primary key
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
+ * @throws NoRowsException Primary key was not found in database.
*/
public static $table.JavaName ${retrieveMethod}($pk.JavaNative pk)
- throws TorqueException
+ throws TorqueException, NoRowsException
{
return ${retrieveMethod}(SimpleKey.keyFor(pk));
}
@@ -998,9 +999,10 @@
* @param pk the primary key
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
+ * @throws NoRowsException Primary key was not found in database.
*/
public static $table.JavaName ${retrieveMethod}(ObjectKey pk)
- throws TorqueException
+ throws TorqueException, NoRowsException
{
Connection db = null;
$table.JavaName retVal = null;
@@ -1023,15 +1025,16 @@
* @param con the connection to use
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
+ * @throws NoRowsException Primary key was not found in database.
*/
public static $table.JavaName ${retrieveMethod}(ObjectKey pk, Connection con)
- throws TorqueException
+ throws TorqueException, NoRowsException
{
Criteria criteria = buildCriteria(pk);
List v = doSelect(criteria, con);
if (v.size() != 1)
{
- throw new TorqueException("Failed to select one and only one row.");
+ throw new NoRowsException("Failed to select one and only one row.");
}
else
{
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>