public boolean add(Address newObj) {
    String values = null;
    int id = 0, typeId = 0;
    boolean result = false;

    try {
      typeId = _dao.typeGateway().getByType(ADDRESS_TABLE, newObj.getType().toString());

      values = "NULL, " + newObj.getClientId() + ", '" + newObj.getAddress() + "', " + typeId + "";
      _commandString = "INSERT INTO " + ADDRESS_TABLE + " VALUES(" + values + ")";
      _updateCount = _statement.executeUpdate(_commandString);
      result = _dao.checkWarning(_statement, _updateCount);

      // set id
      if (result) {
        _commandString = "CALL IDENTITY()";
        _resultSet = _statement.executeQuery(_commandString);

        while (_resultSet.next()) {
          id = _resultSet.getInt(1);
        }
        newObj.setID(id);
        _resultSet.close();
      }

    } catch (Exception e) {
      _dao.processSQLError(e);
    }

    return result;
  }
  public void update(Address obj) {
    String values = null, where = null;
    int typeId = 0;

    try {
      typeId = _dao.typeGateway().getByType(ADDRESS_TABLE, obj.getType().toString());

      values =
          CLIENT_ID
              + " = "
              + obj.getClientId()
              + ", "
              + ADDRESS
              + " = '"
              + obj.getAddress()
              + "', "
              + ADDRESSTYPE_ID
              + " = "
              + typeId
              + "";
      where = "WHERE " + ID + " = " + obj.getID();
      _commandString = "UPDATE " + ADDRESS_TABLE + " SET " + values + " " + where;
      _updateCount = _statement.executeUpdate(_commandString);
    } catch (Exception e) {
      _dao.processSQLError(e);
    }
  }