diff options
author | Matthew Newhook <matthew@zeroc.com> | 2008-09-15 14:05:14 -0230 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2008-09-15 14:05:14 -0230 |
commit | 49f1043448df47478393278167cae33570d14f9d (patch) | |
tree | 747d2bbf01745efcb3bcdbe0018d21fb59c93d46 /java/demo/Database/library/BookI.java | |
parent | fixed bug with fix by ISBN. (diff) | |
download | ice-49f1043448df47478393278167cae33570d14f9d.tar.bz2 ice-49f1043448df47478393278167cae33570d14f9d.tar.xz ice-49f1043448df47478393278167cae33570d14f9d.zip |
add renter to the BookRentedException.
Diffstat (limited to 'java/demo/Database/library/BookI.java')
-rw-r--r-- | java/demo/Database/library/BookI.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/java/demo/Database/library/BookI.java b/java/demo/Database/library/BookI.java index 0eca50de062..01499a1e93a 100644 --- a/java/demo/Database/library/BookI.java +++ b/java/demo/Database/library/BookI.java @@ -247,17 +247,21 @@ class BookI extends _BookDisp throw new Ice.ObjectNotExistException(); } - rs.getInt("renter_id"); + Integer renterId = rs.getInt("renter_id"); if(!rs.wasNull()) { - throw new BookRentedException(); + stmt = context.prepareStatement("SELECT * FROM customers WHERE id = ?"); + stmt.setInt(1, renterId); + rs = stmt.executeQuery(); + boolean next = rs.next(); + assert next; + throw new BookRentedException(rs.getString("name")); } stmt = context.prepareStatement("SELECT * FROM customers WHERE name = ?"); stmt.setString(1, name); rs = stmt.executeQuery(); - Integer renterId = null; if(rs.next()) { renterId = rs.getInt("id"); |