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
{
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>