有什么方法可以限制DynamoDb中自动生成的hashKey的长度 [英] Is there any way we can restrict the length of Auto generated hashKey in DynamoDb

查看:172
本文介绍了有什么方法可以限制DynamoDb中自动生成的hashKey的长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码(Java Entity类),执行我的Java代码后,我能够自动为我的列id / myId生成唯一的hashkey值。

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.

看起来像这样的 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;

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

@DynamoDBTable(tableName = test_app)
公共类MyApplication {

@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;
}

}

推荐答案

自动增量键实际上不是Dynamo的功能...

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

这是Java SDK的一个插件。它所做的只是生成一个UUID,所以它不能更短。

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

这篇关于有什么方法可以限制DynamoDb中自动生成的hashKey的长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆