6

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

1

3 Answers 3

11

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Hey David, Is this implemented for Android SDK as well? I tried to add compile 'com.amazonaws.services.dynamodbv2:amazon-dynamodb-transactions:1.1.2' in my build.gradle but android studio is unable to find the artifact!
0

You could start by looking at how DynamoDB parses objects before saving. You can view DynamoDBMapper code on GitHub. You're should be looking for the protected class SaveObjectHandler implementations in the function save

Questions / Feature requests should be either logged at the issues section of the project on GitHub (There's one already for supporting DynamoDBMapper) or discussed in the AWS DynamoDB forum

1 Comment

Yes, I looked at the source code you mentioned, but there is not a public method to call, and the flow of the logic is not simple enough to be reused outside the original class. I posted the answer on the Aws DynamoDB forum, I'll update this post if someone should give me the solution.
0

FYI - AWS launched DynamoDBMapper support for the built-in transactions API library (launched at re:Invent 2018): https://aws.amazon.com/about-aws/whats-new/2019/04/dynamodbmapper-now-supports-amazon-dynamodb-transactional-api-calls/

2 Comments

Better as a comment.
Agreed should be converted to a comment.

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.