3

While using AWS JAva SDK, for defining DynamoDBHashKey we @DynamoDBHashKey annotation.

Strangely if i use annotation as below

@DynamoDBHashKey 
String Abc

instead of

@DynamoDBHashKey 
String abc

this gives me an error, no mapping for HASH key [junit] at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapperTableModel.hashKey(DynamoDBMapperTableModel.java:119) [junit] at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapperTableModel$Builder.build(DynamoDBMapperTableModel.java:449) [junit] at com.amazonaws.services.dynamodbv2.datamodeling.StandardModelFactories$StandardTableFactory.getTable(StandardModelFactories.java:104) [junit] at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper.getTableModel(DynamoDBMapper.java:393) [junit] at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper.generateCreateTableRequest(DynamoDBMapper.java:2148) [junit] at com.amazonaws.services.dynamodbv2.datamodeling.AbstractDynamoDBMapper.generateCreateTableRequest(AbstractDynamoDBMapper.java:319)

I am unable to understand why does variable naming convention plays a role in failure Any Idea?

1
  • If the solution below works for you please accept and up vote. You might consider filing an issue on the AWS SDK for Java. Commented Mar 15, 2017 at 6:16

1 Answer 1

2

Introspection magic does not appear to be working in this case. Force the attribute name with the parameter attributeName.

@DynamoDBTable(tableName="Books")
public static class Book {
    private String Abc;

    @DynamoDBHashKey(attributeName="Abc")
    public int getAbc() {
        return Abc;
    }
}
Sign up to request clarification or add additional context in comments.

1 Comment

Forget to add this, i tried the same in infact i did mention attributenae explicictly still faced the same issue

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.