Is there any way we can restrict the length of Auto generated hashKey in DynamoDb

删除回忆录丶 提交于 2020-01-16 08:46:30

问题


I have the below code (Java Entity class)and upon executing my java code I am able to auto-generate the unique hashkey value for my column id/myId.

Which look like this "88a2795a-3836-4720-926a-517506b18469".

My question: Is there any way we can restrict the length of Auto generated hashKey in DynamoDb or we can formate it.

import com.amazonaws.services.dynamodbv2.datamodeling.*; import org.springframework.data.annotation.Id;

@DynamoDBTable(tableName = "test_app") public class MyApplication {

private String id;

@Id
@DynamoDBHashKey(attributeName = "myId")
@DynamoDBAutoGeneratedKey
public String getId() {
    return id;
}
public void setId(String id) {
    this.id = id;
}

}


回答1:


Auto-increment key isn't actually a function of Dynamo...

It's an add-in to the Java SDK. All it's doing is generating a UUID, so no it can not be shorter.



来源:https://stackoverflow.com/questions/59040938/is-there-any-way-we-can-restrict-the-length-of-auto-generated-hashkey-in-dynamod

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!