问题
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