java—我们可以将标记接口定义为dynamodb属性/文档吗?

yvgpqqbh  于 2021-08-20  发布在  Java
关注(0)|答案(0)|浏览(141)

我目前正致力于在dynamodb表中引入一个新字段,该表包含关于条目状态的补充信息。
以下是表中每个条目的当前字段。

public class DDBTableEntity {
    @DynamoDBAttribute(attributeName = "customerId")
    private String customerId;

    @DynamoDBAttribute(attributeName = "status")
    private String status;

    @DynamoDBAttribute(attributeName = "countryOfEstablishment")
    private String countryOfEstablishment;
}

我想在dynamodb表中引入一个新字段,它可以根据客户的状态存储补充信息。基于状态值的补充信息可以是单个字符串值,有时也可以是由字符串、字符串、整数和枚举组成的对象。
我想为这个新字段定义一个标记接口: supplementalInformation 在ddbtableentity文件中,并具有扩展此标记接口的类,以便不同类型的补充信息可以存储在dynamodb中的单个字段下。
更改之后,这就是我对ddbtableentity文件的设想。

@DynamoDBAttribute(attributeName = "customerId")
    private String customerId;

    @DynamoDBAttribute(attributeName = "status")
    private String status;

    @DynamoDBAttribute(attributeName = "countryOfEstablishment")
    private String countryOfEstablishment

    @DynamoDBDocument
    public static interface supplementalInformation;

所以我想知道是否有可能在dynamodb中实现这样的标记接口?在这种情况下,我们必须在dynamodb中的一个字段中基于其他值存储多个不同类型的值,那么最佳实践是什么呢。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题