无法在 DynamoDB 中创建多个属性

Not able to create Multiple Attribute in DynamoDB

我需要创建一个具有四个属性的 DynamoDB table。我正在使用以下 Java 程序:

String tableName = "devtest";

Table table = dynamoDB.createTable(tableName,
                    Arrays.asList(new KeySchemaElement("BIC", KeyType.HASH)), // Sort key
                    Arrays.asList(new AttributeDefinition("BIC", ScalarAttributeType.S),
                        new AttributeDefinition("Tenant", ScalarAttributeType.S),
                        new AttributeDefinition("TenantID", ScalarAttributeType.S),
                        new AttributeDefinition("Destination", ScalarAttributeType.S)),
                    new ProvisionedThroughput(10L, 10L));
table.waitForActive();
System.out.println("Success.  Table status: " + table.getDescription().getTableStatus());  
        

我总是收到以下错误:

Unable to create table: 
Unable to unmarshall exception response with the unmarshallers provided (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ValidationException; Request ID: bc0565ac-9d44-4876-934a-b39fbe8ca3f1)

如何解决这个错误?

只能有一个属性BIC,因为这是你的HASH。由于您没有任何排序键、本地或全局二级索引,因此您无法定义任何其他属性。

DynamoDB schema-less,这意味着它没有任何 per-define 结构。