You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for starting DynamoDB Record Version with explicit value
The prior behavior required that a version be initialized with a null value,
this required mapper clients to use Integer instead of the int primitive.
This change allows clients to explicitly initialize the version to a value
which makes it simpler for clients to use primitive values and potentially
avoid null pointer exceptions and checks.
The default starting value of 0 and increment value of 1 are intended to
provide sane defaults that are identical to the existing behavior while
enabling clients to have more fine-graned control over how the versioning
is managed for their specific use-cases.
The current implementation configures the values at the extension level only
but the implementation can be expanded to gather the value from the model
annotation to customize the values on a per table basis.
Copy file name to clipboardExpand all lines: services-custom/dynamodb-enhanced/src/main/java/software/amazon/awssdk/enhanced/dynamodb/extensions/VersionedRecordExtension.java
+50-10Lines changed: 50 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -61,8 +61,20 @@ public final class VersionedRecordExtension implements DynamoDbEnhancedClientExt
Copy file name to clipboardExpand all lines: services-custom/dynamodb-enhanced/src/test/java/software/amazon/awssdk/enhanced/dynamodb/extensions/VersionedRecordExtensionTest.java
+27Lines changed: 27 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -112,6 +112,33 @@ public void beforeWrite_initialVersionDueToExplicitNull_transformedItemIsCorrect
0 commit comments