Java – Dynamic properties in DynamoDB?

Dynamic properties in DynamoDB?… here is a solution to the problem.

Dynamic properties in DynamoDB?

I’m learning DynamoDB, and one of the benefits I’ve read about NoSQL is that the data doesn’t need to be standardized. I was wondering if it is possible to support inserting DynamoDB tables with properties of unknown number and type in Java. Is there any way in DynamoDBMapper or JPA to support this? For example, reading a spreadsheet with different columns, depending on the worksheet, is guaranteed to have two specific columns (hash and range) anyway.

Thank you.

Solution

Is there any way in the DynamoDBMapper or JPA that supports this

JPA (or any object mapping framework in general) maps strongly typed objects to DynamoDB, so the database provides a larger flexible activity than the object framework, which is fine

When you work with pinned objects, DynamoDBMapper seems like a good choice

Spreadsheet that contains different columns depending on the sheet

Let’s say you don’t know the worksheet columns beforehand, and you need to store “any column” you encounter.

IMHO, you don’t have an easy way to map “any column” to a strongly-typed Java object, for that use case I think key/value mapping is best.

As far as I know, you can’t use DynamoDBMapper to store Map properties (correct me if I’m wrong), so in order to use flexible patterns, I’ll skip the JPA or mapper layer entirely.

Related Problems and Solutions