Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DynamoDB: mapper and transactions using java SDK

I am developing a project in Java, and I am using the AWS SDK. I am using Dynamo DB. I am using the mapper, and it is very useful for me because I can perform basic operation directly on a java entity.

Recently, I have seen the library that allows to add transactionality to Dyanamo DB: https://github.com/awslabs/dynamodb-transactions

Such library works really fine, but it does not allow me to use the mapper. It only works with GetRequest, PutRequest, ...

I have no problem when getting results, because I can use the method "marshallIntoObject(Class, Map)" for obtaining the java entity from the results of a query.

How can I perform the same operation for saving/updating an item? I would really like to have a method that takes in input a java entity and converts it to a Map. I would use the returned map for performing query through the transaction engine. Is it available somewhere?

Moreover, are there any plans to make the project "dynamodb-transactions" able to support the mapper?

Thanks

like image 667
Ulisse Avatar asked Oct 15 '13 10:10

Ulisse


People also ask

What method of Mapper class in Java SDK will you use for inserting an item in a DynamoDB table?

The AWS SDK for Java provides a DynamoDBMapper class, allowing you to map your client-side classes to Amazon DynamoDB tables. To use DynamoDBMapper , you define the relationship between items in a DynamoDB table and their corresponding object instances in your code.

Is DynamoDB good for transactional?

Amazon DynamoDB transactions simplify the developer experience of making coordinated, all-or-nothing changes to multiple items both within and across tables. Transactions provide atomicity, consistency, isolation, and durability (ACID) in DynamoDB, helping you to maintain data correctness in your applications.

What is the use of DynamoDB Mapper?

The DynamoDBMapper class is the entry point to Amazon DynamoDB. It provides access to a DynamoDB endpoint and enables you to access your data in various tables. It also enables you to perform various create, read, update, and delete (CRUD) operations on items, and run queries and scans against tables.

What is DynamoDB SDK?

Amazon DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability.


1 Answers

Following up on this: The linked feature request has now been implemented.

The DynamoDB transaction library now supports using the DynamoDB Mapper. Take a look at the examples and the javadocs to get started with it, and feel free to open questions in the github project if you have any.

like image 170
David Yanacek Avatar answered Sep 28 '22 00:09

David Yanacek