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); }
@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; }