Here is my POJO that I use to store in DynamoDB using DynamodbMapper
@DynamoDBTable(tableName = "Data")
// @JsonIgnoreProperties(value = { "content" })
public class Data {
@DynamoDBRangeKey(attributeName = "Url")
@DynamoDBAutoGeneratedKey
@JsonProperty("url")
private String url;
@DynamoDBHashKey(attributeName = "UserName")
@JsonProperty("userName")
private String userName;
@JsonProperty("title")
@DynamoDBAttribute(attributeName = "Title")
private String pasteTitle;
@JsonProperty("content")
private String content;
@JsonProperty("date")
@DynamoDBAttribute(attributeName = "Date")
private String date;
}
Every time I run DynamoDBMapper.save(data)
, it stores content
as well even if it does not have DynamoDBAttribute
annotation. By using @JsonIgnoreProperties(value = { "content" })
it makes the value as null and does not store the content. But I would like to store the content in S3 and not DynamoDB and hence looking for a way to ignore this in DynamoDBAttribute.
You can use @DynamoDBIgnore
- AWS documentation
In your example:
@DynamoDbIgnore
public String getContent() {
return content;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.