dynamodb update list of map

Viewed 163

I am trying to save List<Map<String,AttributeValue>> into dynamodb

The data looks like

"includeData" : [
    {
      "data" : "[VALUE]",
      "work" : "[VALUE]",
      "product" : "[VALUE]",
      "catagory" : "[VALUE]",
      "type" : "[VALUE]"
    },
    {
      "data" : "[VALUE]",
      "work" : "[VALUE]",
      "product" : "[VALUE]",
      "catagory" : "[VALUE]",
      "type" : "[VALUE]"
    }
]

In the code, I am creating the update request as

Map<String, AttributeValue> annExpressionAttributeValues = new HashMap<>();
annExpressionAttributeValues.put(V_INCLUDE_DATA, new AttributeValue().withL(Arrays.asList([LIST])));

new UpdateItemRequest().withTableName([TABLE_NAME])
    .withKey(keys).withUpdateExpression("SET #includeData = :v_includeData").withExpressionAttributeNames(annExpressionAttributeNames)
           .withExpressionAttributeValues(annExpressionAttributeValues).withReturnValues(ReturnValue.ALL_NEW);

I am facing at line AttributeValue().withL(Arrays.asList(annExpressionAttributeValues)));

withL is not suitable for this requirement. I cannot find any other. How can I update this data structure in dynamodb

0 Answers
Related