DynamoDB PutItemOutcome#getPutItemResult() returns empty object

Viewed 2066

I'm trying to run the following example from AWS Dynamo tutorial locally, Step 3: Put, Update, and Delete an Item.

In my case, it is:

val client: AmazonDynamoDBClient = new AmazonDynamoDBClient().withEndpoint("http://localhost:7777")

val dynamoDB: DynamoDB = new DynamoDB(client)

val  table: Table = dynamoDB.getTable("Catalog")

try {

    val rating: java.util.List[Float] = new java.util.LinkedList[Float]()

    rating.add(1)

    val newItem: Item = new Item().withPrimaryKey("Title", "Title here").withInt("Country", 1).
        withList("Ratings", rating)

    val outcome: PutItemOutcome = table.putItem(newItem)

    System.out.println("PutItem succeeded:\n" + outcome.getPutItemResult)

    } catch {

       case exception: Exception => System.out.println(exception.getMessage)

}

The output is:

PutItem succeeded: {}

While in local DynamoDB console:

var params = { 
TableName: "Catalog",
Key: {
    "Title":"Title Here",
}
};

docClient.get(params, function(err, data) {
  if (err)
    console.log(JSON.stringify(err, null, 2));
  else
    console.log(JSON.stringify(data, null, 2));
});

Output:

{ "Item": { "Title": "Title Here", "Ratings": [ 1 ], "Country": 1 } }

1 Answers
Related