Exemplo n.º 1
0
  public void updateJournalNote(DocumentNote documentNote) throws Exception {

    kLogger.fine("Updating journal notes id=" + documentNote.getNoteId());

    Connection connection = ConnectionPoolManager.getInstance().getConnection();

    PreparedStatement psUpdate = connection.prepareStatement(SQL_UPDATE_JOURNALNOTE);

    int i = 1;

    psUpdate.setString(i++, documentNote.getNoteData());
    psUpdate.setString(i++, documentNote.getUserName().toUpperCase());
    psUpdate.setString(i++, documentNote.getCreated());
    if (documentNote.isActive()) {
      psUpdate.setString(i++, "Y");
    } else {
      psUpdate.setString(i++, "N");
    }
    psUpdate.setInt(i++, documentNote.getDocumentId());
    psUpdate.setString(i++, documentNote.getNoteType());

    psUpdate.setInt(i++, documentNote.getNoteId());

    int recCount = psUpdate.executeUpdate();

    psUpdate.close();
    connection.commit();
    connection.close();

    if (recCount == 0) {
      kLogger.warning("Unable to update journal notes id=" + documentNote.getNoteId());
      throw new Exception("Unable to update journal notes id=" + documentNote.getNoteId());
    }
  }