Closed mamakancha closed 2 years ago
Apologies for the delay, taking a look.
I think SaveBehavior is not supported in transactionWrite. I'm digging into the code to confirm because the docs don't explicitly say that.
And, of course, immediately after I wrote that comment I found a documentation (DynamoDBMapper link):
This method ignores any SaveBehavior set on the mapper. Whether an object is put or updated is solely determined by the TransactionWriteRequest method called by user while constructing request object. Furthermore, put and update work as if SaveBehavior is set as CLOBBER.
Changing to a Guidance question and marking this to auto-close soon. Add a comment if you have further questions, it will prevent the issue to be auto-closed.
how to sovle the issue ?i don't want to update all the null fields
@mamakancha have you solved this issue? could you share me your solution? thanks
i found a way to work around. just create a DDB mapper POJO class to put the fields that your want to update and the hash fields in it. other field will not be chagned after transactionwrite
@weibian-wyze can you please explain your approach a bit or better if you could share an approach commit. Thanks!
Describe the bug
I'm trying to use DynamoDB transactions in the following manner ( using Kotlin ) :
Where, dynamoDBMapperConfig is defined as :
My object looks like :
In my DDB Table, this is stored as
Expected behavior
The table should've had the following entry :
Current behavior
The table rather has :
createdAt should've been skipped but was removed instead from the table.
Steps to Reproduce
Create an object and insert it into dynamodb table with the following attributes :
id ( PK )
,name
,createdAt
Then update the same object with createdAt set as null.
Using the following dependency :
Possible Solution
generateUpdate
method ( InDynamoDBMapper.java
) is not considering the fact thatUPDATE_SKIP_NULL_ATTRIBUTES
was passed as part of config and hence creating a map of null non key values and removing them.Context
No response
AWS Java SDK version used
1.12.70
JDK version used
11
Operating System and version
macOS Big Sur, 11.6