How to resolve optimistic lock failure (ConditionalCheckFailedException) while saving to dynamoDB for the first time?

0 votes
asked Jun 10, 2015 by Kumar


I have a table with version attribute.

I see an issue where in the first-time save is given an optimistic lock failure exception while trying to insert new record into The conditional request failed (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ConditionalCheckFailedException;table using method.



1 Answer

0 votes
answered Jul 5, 2015 by rams (828 points)
Use DynamoDbMapperConfig Save type as CLOBBER, which means to say DynamoDB that erase any existing version and do not complain of version integrity.
The Save OPERATION in CLOBBER mode will initialize the version number to 1.