Skip to content

Commit 0b7895e

Browse files
committed
Added support for DynamoDbAutoGeneratedKey annotation
1 parent 14ff258 commit 0b7895e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

services-custom/dynamodb-enhanced/src/test/java/software/amazon/awssdk/enhanced/dynamodb/functionaltests/AutoGeneratedKeyRecordTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ public void autogenerateKey_setOnInvalidKeyAttribute_throws_exception() {
261261

262262
@Test
263263
public void autogenerateKey_onVersionedRecord_setOnPrimaryKey_performsUuidGeneration() {
264+
// NOTE: UpdateBehavior has no effect on primary keys since they cannot be null in DynamoDB
264265
DynamoDbEnhancedClient client = DynamoDbEnhancedClient.builder()
265266
.dynamoDbClient(getDynamoDbClient())
266267
.extensions(AutoGeneratedKeyExtension.builder().build(),
@@ -582,6 +583,7 @@ public static class VersionedRecord {
582583
private Long version;
583584
private String payload;
584585

586+
// NOTE: UpdateBehavior has no effect on primary keys since they cannot be null in DynamoDB
585587
@DynamoDbPartitionKey
586588
@DynamoDbAutoGeneratedKey
587589
public String getId() {
@@ -650,7 +652,6 @@ public void setId(String id) {
650652
// since primary keys cannot be null in DynamoDB and are required for UpdateItem
651653
@DynamoDbSortKey
652654
@DynamoDbAutoGeneratedKey
653-
@DynamoDbUpdateBehavior(UpdateBehavior.WRITE_IF_NOT_EXISTS)
654655
public String getSortKey() {
655656
return sortKey;
656657
}

0 commit comments

Comments
 (0)