public void save(Connection conn) throws SQLException {
   boolean is_new = isNew();
   String query =
       (is_new
           ? ("insert into "
               + tableName()
               + " ("
               + recordIDColumnName()
               + ",mod_count,date_entered,date_modified,name,status,product) values (?,?,?,?,?,?,?)")
           : ("update "
               + tableName()
               + " set mod_count = ?, date_entered = ?, "
               + "date_modified = ?, name = ?, status = ?, product = ? where "
               + recordIDColumnName()
               + " = ?"));
   int idx = 1;
   PreparedStatement ps = conn.prepareStatement(query);
   if (is_new) {
     ps.setInt(idx++, getId().intValue());
   }
   int new_mod_count = mod_count.intValue() + 1;
   ps.setInt(idx++, new_mod_count);
   ps.setTimestamp(idx++, date_entered);
   ps.setTimestamp(idx++, date_modified); // ---TODO: set to current time
   ps.setString(idx++, getName());
   ps.setString(idx++, getStatus());
   ps.setInt(idx++, getProduct().getId().intValue());
   if (!is_new) {
     ps.setInt(idx++, getId().intValue());
   }
   ps.executeUpdate();
   ps.close();
   // Only increment the mod_count if there was no exception during the save.
   setModCount(new Integer(new_mod_count));
 }
 private void insertLog(HttpServletRequest req, Connection connection) throws SQLException {
   try (PreparedStatement stmt =
       connection.prepareStatement("INSERT INTO LOGGING (date,ip,url) VALUES (?,?,?)")) {
     stmt.setTimestamp(1, new Timestamp((new java.util.Date()).getTime()));
     stmt.setString(2, req.getRemoteAddr());
     stmt.setString(3, req.getRequestURI());
     stmt.executeUpdate();
   }
 }