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
Copy file name to clipboardExpand all lines: services-custom/dynamodb-enhanced/src/main/java/software/amazon/awssdk/enhanced/dynamodb/extensions/AutoGeneratedKeyExtension.java
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -42,13 +42,13 @@
42
42
* Generates a random UUID (via {@link java.util.UUID#randomUUID()}) for any attribute tagged with
43
43
* {@code @DynamoDbAutoGeneratedKey} when that attribute is missing or empty on a write (put/update).
44
44
* <p>
45
-
* <b>Key Difference from @DynamoDbAutoGeneratedUuid:</b> This extension only generates UUIDs when the
46
-
* attribute value is null or empty, preserving existing values. In contrast, {@code @DynamoDbAutoGeneratedUuid}
47
-
* always generates new UUIDs regardless of existing values.
45
+
* <b>Key Difference from @DynamoDbAutoGeneratedUuid:</b> This extension only generates UUIDs when the
46
+
* attribute value is null or empty, preserving existing values. In contrast, {@code @DynamoDbAutoGeneratedUuid} always generates
47
+
* new UUIDs regardless of existing values.
48
48
* <p>
49
49
* <b>Conflict Detection:</b> This extension cannot be used together with {@code @DynamoDbAutoGeneratedUuid} on the same
50
-
* attribute. If both annotations are applied to the same field, an {@link IllegalArgumentException} will be thrown
51
-
* at runtime to prevent unpredictable behavior based on extension load order.
50
+
* attribute. If both annotations are applied to the same field, an {@link IllegalArgumentException} will be thrown at runtime to
51
+
* prevent unpredictable behavior based on extension load order.
52
52
* <p>
53
53
* The annotation may be placed <b>only</b> on key attributes:
54
54
* <ul>
@@ -60,7 +60,7 @@
60
60
* annotated attributes against the table's known key attributes. If an annotated attribute
61
61
* is not a PK/SK or an GSI/LSI, an {@link IllegalArgumentException} is thrown.</p>
62
62
*
63
-
* <p><b>UpdateBehavior Limitations:</b> {@code @DynamoDbUpdateBehavior} has no effect on primary keys due to
63
+
* <p><b>UpdateBehavior Limitations:</b> {@code @DynamoDbUpdateBehavior} has no effect on primary keys due to
64
64
* DynamoDB's UpdateItem API requirements. It only affects secondary index keys.</p>
65
65
*/
66
66
@SdkPublicApi
@@ -92,8 +92,8 @@ public static Builder builder() {
92
92
* If this table has attributes tagged for auto-generation, insert a UUID value into the outgoing item for any such attribute
93
93
* that is currently missing/empty. Unlike {@code @DynamoDbAutoGeneratedUuid}, this preserves existing values.
94
94
* <p>
95
-
* Also validates that the annotation is only used on PK/SK/GSI/LSI key attributes and that there are no conflicts
96
-
* with @DynamoDbAutoGeneratedUuid.
95
+
* Also validates that the annotation is only used on PK/SK/GSI/LSI key attributes and that there are no conflicts with
Copy file name to clipboardExpand all lines: services-custom/dynamodb-enhanced/src/test/java/software/amazon/awssdk/enhanced/dynamodb/extensions/AutoGeneratedKeyExtensionTest.java
Copy file name to clipboardExpand all lines: services-custom/dynamodb-enhanced/src/test/java/software/amazon/awssdk/enhanced/dynamodb/extensions/AutoGeneratedUuidExtensionTest.java
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -189,7 +189,8 @@ public void conflictingAnnotations_throwsIllegalArgumentException() {
189
189
.tableMetadata(conflictingSchema.tableMetadata())
190
190
.operationName(OperationName.PUT_ITEM)
191
191
.operationContext(PRIMARY_CONTEXT)
192
-
.build()))
192
+
.build())
193
+
)
193
194
.withMessage("Attribute 'id' cannot have both @DynamoDbAutoGeneratedKey and @DynamoDbAutoGeneratedUuid annotations. "
194
195
+ "These annotations have conflicting behaviors and cannot be used together on the same attribute.");
Copy file name to clipboardExpand all lines: services-custom/dynamodb-enhanced/src/test/java/software/amazon/awssdk/enhanced/dynamodb/extensions/ConflictingAnnotationsTest.java
0 commit comments