aws / aws-sdk-java-v2

The official AWS SDK for Java - Version 2
Apache License 2.0
2.2k stars 853 forks source link

read generated value from @DynamoDbAutoGeneratedUuid from AutoGeneratedUuidExtension in case table uses @DynamoDbImmutable #5675

Open michalgebauer opened 3 weeks ago

michalgebauer commented 3 weeks ago

Describe the feature

Currently there is no way how to read generated Uuid in case it was used on partition key attribute in immutable DynamoDb table. The extension only decorates PutItem operation but since the DB model is immutable we can't get to the actual value used during Put. Calling getItem afterwards makes no sense, since we don't know the partition key of newly created item

Use Case

It is very typical to use generated UUID as partition key. As of now, this is not possible.

Proposed Solution

Put request could have a method that would be triggered when all extensions where applied to item or putItem response could contain final version of item that was used during PutItem operation

Other Information

No response

Acknowledgements

AWS Java SDK version used

dynamodb-enhanced-2.28.27.jar

JDK version used

17

Operating System and version

macOs 15.0.1