예제 #1
0
  public void deleteTickerRow(Integer index) {

    AttributeValue val = new AttributeValue().withN(index.toString());

    Key primaryKey = new Key().withHashKeyElement(val);

    DeleteItemRequest deleteItemRequest =
        new DeleteItemRequest().withTableName(tableName).withKey(primaryKey);

    db.deleteItem(deleteItemRequest);
  }
예제 #2
0
  @Override
  public int delete(String table, String key) {
    logger.debug("deletekey: " + key + " from table: " + table);
    DeleteItemRequest req = new DeleteItemRequest(table, createPrimaryKey(key));
    DeleteItemResult res = null;

    try {
      res = dynamoDB.deleteItem(req);
    } catch (AmazonServiceException ex) {
      logger.error(ex.getMessage());
      return SERVER_ERROR;
    } catch (AmazonClientException ex) {
      logger.error(ex.getMessage());
      return CLIENT_ERROR;
    }
    return OK;
  }