不存在HASH密钥值 - AWS DynamoDBMapper.batchLoad

时间:2017-04-12 23:37:01

标签: java amazon-web-services amazon-dynamodb aws-lambda

我正在尝试批量加载AWS中的几个项目。即使我为每个值设置了正确的主键,Java SDK和我仍然会收到没有HASH键值的错误。这是我的代码,当我点击dbMapper.batchLoad()行时发生崩溃。

ArrayList friendsTblsToGet = new ArrayList();

    Friends friendTblOne = new Friends();
    friendTblOne.setFriendsId(friendsTblInfo.get("friendId1"));
    Friends friendTblTwo = new Friends();
    friendTblTwo.setFriendsId(friendsTblInfo.get("friendTbl2"));

    friendsTblsToGet.add(friendTblOne);
    friendsTblsToGet.add(friendTblTwo);

    Map<String, List<Object>> friendsToLoad = dbMapper.batchLoad(friendsTblsToGet);

这是堆栈跟踪:

{
  "errorMessage": "Friends[friendsId]; no HASH key value present",
  "errorType": "com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMappingException",
  "stackTrace": [
    "com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapperTableModel.convertKey(DynamoDBMapperTableModel.java:329)",
    "com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapperTableModel.convertKey(DynamoDBMapperTableModel.java:310)",
    "com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper.batchLoad(DynamoDBMapper.java:1282)",
    "com.amazonaws.services.dynamodbv2.datamodeling.AbstractDynamoDBMapper.batchLoad(AbstractDynamoDBMapper.java:196)",
    "com.treyherman.lambda.gifwrap.InteractionInterface.getFriendsTables(InteractionInterface.java:230)",
    "com.treyherman.lambda.gifwrap.UserInteractionFunctionHandler.getFriendsTables(UserInteractionFunctionHandler.java:64)",
    "sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)",
    "sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)",
    "sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)",
    "java.lang.reflect.Method.invoke(Method.java:498)"
  ]

有谁知道我可能在哪里出错?我按照AWS文档进行了操作,在此处找到: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBMapper.Methods.html#w1ab1c13c19c21c43c31

0 个答案:

没有答案