I have a Dynamo table that uses optimistic locking via the DynamoDBVersionAttribute to ensure that only one worker at a time has a document reserved. However, when I want to clean up a document, the delete throws a ConditionalCheckFailedException when I don't set the version in the DynamoDBMapper.
At that point, I don't care what version the document is, and I want to delete it no matter what version it is. Is there a way to force the delete without worrying about the version? I want to overcome the exception without having to query Dynamo for the document.
You can delete the item by specifying the SaveBehaviour as CLOBBER without worrying about the version.
DynamoDBMapper mapper;
mapper.delete(object, new DynamoDBMapperConfig(DynamoDBMapperConfig.SaveBehavior.CLOBBER)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With