Package nz.co.transparent.client.db

Examples of nz.co.transparent.client.db.ControllerException


      }
     
      try {
        return queryRunner.update(conn, sql, params);
      } catch (SQLException se) {
        throw new ControllerException(se);
      }
    } catch (SQLException se) {
      log.warning("GenericController SQLException: " + se.getMessage());
      throw new ControllerException(se);
    }
  }
View Full Code Here


      }
     
      return queryRunner.update(conn, sql);
    } catch (SQLException se) {
      log.warning("GenericController SQLException: " + se.getMessage());
      throw new ControllerException(se);
    }
  }
View Full Code Here

      sql = "select * from " + tableName;
      sql += " where (" + primaryKeyName + "=?)";
      Map columnMapTemp = (Map) queryRunner.query(conn, sql, columnMap.get(primaryKeyName), rsh);

      if (columnMapTemp == null) {
        throw new ControllerException("Cannot find record.");
      }
     
      Date oldDate = (java.util.Date) columnMap.get("date_updated");
      Date newDate = (java.util.Date) columnMapTemp.get("date_updated");
      if (!oldDate.equals(newDate)) {
        throw new UpdaterException()// Signal that record has already been changed
      }
     
      sql = "update " + tableName;
      String parameter = null;
      String columnName = null;
      List columnNameList = null;
      List paramList = new ArrayList();
      // Iterate over columns
      Set columnSet = columnMapTemp.keySet();
      Iterator iterator = columnSet.iterator();
      int i = 0;
     
      while (iterator.hasNext()) {
        columnName = (String) iterator.next();
       
        if (columnName.equals("date_updated")) {
          parameter = "CURRENT_TIMESTAMP";
        } else {
          parameter = "?";
          paramList.add(columnMap.get(columnName));
        }
       
        if (i++ == 0) {
        sql += " set " + columnName + " = " + parameter;
        } else {
          sql += " ," + columnName + " = " + parameter;
        }
      }
     
      sql += " where (" + primaryKeyName + "=?)";
      paramList.add(columnMap.get(primaryKeyName))// Add primaryKey value to paramList
      return queryRunner.update(conn, sql, paramList.toArray());
    } catch (SQLException se) {
      log.warning("SQL Exception: " + se.getMessage());
      throw new ControllerException(se);
    }
  }
View Full Code Here

      return (List) queryRunner.query(sql, new Integer(clientID), rsh);
    } catch (SQLException se) {
      String message = "SpecificController: SQL Exception: " + se.getMessage();
      log.warning(message);
      throw new ControllerException(se)// wrap SQLException
    }
  }
View Full Code Here

        return (Map) queryRunner.query(sql, rsh);
      } catch (SQLException se) {
        String msg = "SQL error:\n" + se.getMessage();
        log.warning(msg);
        throw new ControllerException(msg);
      }
  }
View Full Code Here

      return (List) queryRunner.query(sql, new Integer(invoiceID), rsh);
    } catch (SQLException se) {
      String message = "SpecificController: SQL Exception: " + se.getMessage();
      log.warning(message);
      throw new ControllerException(se)// wrap SQLException
    }
  }
View Full Code Here

     
      return invoiceList;
    } catch (SQLException se) {
      String message = "SpecificController: SQL Exception: " + se.getMessage();
      log.warning(message);
      throw new ControllerException(se)// wrap SQLException
    }
  }
View Full Code Here

      return (List) queryRunner.query(sql, new Integer(personID), rsh);
    } catch (SQLException se) {
      String message = "SpecificController: SQL Exception: " + se.getMessage();
      log.warning(message);
      throw new ControllerException(se);
    }
  }
View Full Code Here

       
      return mapList;
    } catch (SQLException se) {
      String message = "SpecificController: SQL Exception: " + se.getMessage();
      log.warning(message);
      throw new ControllerException(se);
    } finally {
      try {
        DbUtils.close(rst);
        DbUtils.close(stmt);
        DbUtils.close(conn);
      } catch (SQLException se) {
        String message = "SpecificController: SQL Exception: " + se.getMessage();
        log.warning(message);
        throw new ControllerException(se);
      }
    }
  }
View Full Code Here

       
      return mapList;
    } catch (SQLException se) {
      String message = "SpecificController: SQL Exception: " + se.getMessage();
      log.warning(message);
      throw new ControllerException(se);
    } finally {
      try {
        DbUtils.close(personResultSet);
        DbUtils.close(stmt);
        DbUtils.close(conn);
      } catch (SQLException se) {
        String message = "SpecificController: SQL Exception: " + se.getMessage();
        log.warning(message);
        throw new ControllerException(se);
      }
    }
  }
View Full Code Here

TOP

Related Classes of nz.co.transparent.client.db.ControllerException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.