Dynamic Table Name in DynamoDB with Java DynamoMapper - Jayway
In my current project we want AWS CloudFormation to determine the names of our DynamoDB tables by setting them as properties in a standard Java property file. Our service reads this property file on startup and thus get the tables names that we want to use. So far so good but it turns out that if we want to make use of the object mapper (DynamoMapper
) that Amazon provides to allow us to annotate our entities we now run into a bit of a problem. The problem is that the Java object representing a DynamoDB entity needs a @DynamoDBTable
annotation specifying the table name to use, for example @DynamoDBTable(tableName = "my_table_name")
. The string "my_table_name"
that we pass into the tableName
attribute needs to be resolved at compile-time due to the nature of annotations in Java. Thus it seems like we need to know and specify the table name before we start our application and can read it from our property file.Read full article from Dynamic Table Name in DynamoDB with Java DynamoMapper - Jayway
No comments:
Post a Comment