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

0 votes
671 views
asked Jun 10, 2015 by Kumar

resolve com.amazonaws.services.dynamodbv2.model.ConditionalCheckFailedException

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 com.amazonaws.services.dynamodbv2.model.ConditionalCheckFailedException: The conditional request failed (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ConditionalCheckFailedException;table using DynamoDBMapper.save method.

 

 

1 Answer

0 votes
answered Jul 5, 2015 by rams (805 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.
...