我目前正在使用Java dynamoMapper创建和查询表。尝试使用全局二级索引创建表时,出现以下错误

No provisioned throughput specified for the global secondary index 

My java class representing the table has this attribute for the global secondary index.

@DynamoDBIndexHashKey(globalSecondaryIndexName="sender")
    public String getSender() {
    return sender;
}

创建表的类看起来像这样
public boolean createTable() {
try {
DynamoDBMapper mapper = new DynamoDBMapper(client);
CreateTableRequest tableRequest =     mapper.generateCreateTableRequest(entityClass); // 1
tableRequest.setProvisionedThroughput(new ProvisionedThroughput(1000L, 1500L)); // 2
client.createTable(tableRequest); // 3

    } catch (Error e) {
        e.printStackTrace();
        return false;

    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
    return true;
}

我已经在Amazon网站上搜索了其他注释和配置,但DynamoMapper没有任何 react 。无论如何,是否有使用ORM进行此操作的方法,还是我必须使用较低级别的API手动创建?

最佳答案

您还需要在将要生成的每个二级索引表上设置预配置的吞吐量。

tableRequest.getGlobalSecondaryIndexes().get(0).setProvisionedThroughput(new ProvisionedThroughput(10l, 10l));

09-05 12:47