We have a DynamoDB table Test which has an attribute Template. Bellow are the class definitions. I would like to update the Template attribute or some of its attribute based on certain condition. I tried doing the same using UpdateItemRequest but unable to find a way to update the template attribute since everything is converted to either string, number or bytes.
Code for reference.
@DynamoDbBean
public class Test implements NoSQLEntity {
private String name;
private Template template;
@DynamoDbAttribute("name")
public String getName() {
return name;
}
@DynamoDbAttribute("template")
public Template getTemplate() {
return template;
}
}
@DynamoDbBean
public class Template {
private String pk;
private String name;
private List<String> demo;
@DynamoDbAttribute("pk")
public String getPk() {
return this.pk;
}
@DynamoDbAttribute("name")
public String getName() {
return name;
}
@DynamoDbAttribute("demo")
public List<String> getdemo() {
return demo;
}
}
Sample update code:
UpdateItemRequest request = UpdateItemRequest.builder()
.tableName("Test")
.key(itemKey)
.updateExpression("SET tmpt = :tmt")
.expressionAttributeValues(expressionValues)
.build();
Here I am unable to build the :tmt using the AttributeValue. Can someone please guide me?