db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon August <...@internection.com>
Subject MySQL - Can insert and select but not update...
Date Fri, 15 Dec 2006 13:37:14 GMT
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.


Here's my getOrderLineById:

   public static OrderLine getOrderLineById(int orderId, int itemId) {
     try {
       Criteria c = new Criteria();
       c.add(OrderLinePeer.ORDER_ID, orderId);
       c.add(OrderLinePeer.ITEM_ID, itemId);
       List olList = OrderLinePeer.doSelect(c);
       return (OrderLine) olList.get(0);
     } catch (TorqueException ex) {
         // Log error to log file
     }
     return null;
   }

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


Mime
View raw message