db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shane Beasley <sbeas...@acm.org>
Subject Re: MySQL - Can insert and select but not update...
Date Fri, 15 Dec 2006 16:12:22 GMT
Jon August wrote:

>  I'm using Torque 3.2 and MySQL.  I'm having no problems inserting
>  data and selecting data, but when I try the following, it doesn't get
>  saved to the database:
>  if (OrderLine.lineExists(orderId, itemId)) { ol =
>  OrderLine.getOrderLineById(orderId, itemId);
>  ol.setQuantity(quantity); try { ol.save(); } catch (Exception ex) { }
>  }
>  I can throw a "System.out.println(ol.getQuantity())" after the
>  setQuantity and it returns the updated quantity.  The save just
>  doesn't seem to stick.

Hmm... Try catch (Exception ex) { ex.printStackTrace(); } and see if an 
exception was thrown. :)

NB: Almost universally, an empty catch-block is a bad thing. I tend to 
use ex.printStackTrace() for notable but otherwise ignorable exceptions, 
and I throw new RuntimeException(ex) for unignorable exceptions that 
"should never happen." The only "exception" (pun intended) is an 
exception that's not particularly exceptional (e.g. when 
ObjectInputStream.readObject() throws EOFException -- which, as far as I 
know, is the only way to tell that ObjectInputStream is actually at EOF).


To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org

View raw message