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
The v1 mapper would evaluate the in memory value of the field on the item before applying the auto generated time stamp.
So for example if you are using putItem with versioned updates to a previous item this would not modify the created at timestamp.
The enhanced client will alway overwrite the DynamoDBAutoGeneratedTimestamp regardless of whether it has a value in memory.
Regression Issue
Select this option if this issue appears to be a regression.
Expected Behavior
var customer = Customer(id = 1, name = "John Smith")
// Put a new item
customerTable.putItem(customer);
customer = customerTable.getItem(1)
// version = 1, created_at = t0, updated_at = t0)
customer = customer.copy(email = "[email protected]")
// Put an updated item
customerTable.putItem(customer);
customer = customerTable.getItem(1)
// version = 2, created_at = t0, updated_at = t1)
Current Behavior
var customer = Customer(id = 1, name = "John Smith")
// Put a new item
customerTable.putItem(customer);
customer = customerTable.getItem(1)
// version = 1, created_at = t0, updated_at = t0)
customer = customer.copy(email = "[email protected]")
// Put an updated item
customerTable.putItem(customer);
customer = customerTable.getItem(1)
// version = 2, created_at = t1, updated_at = t1) <-- created_at is updated to the latest timestamp unconditionally.
Reproduction Steps
@DynamoDbBean
public class Customer {
private String id;
private String name;
private String email;
private Long version;
private Instant created_at;
private Instant updated_at;
@DynamoDbPartitionKey
public String getId() { return this.id; }
public void setId(String id) { this.id = id; }
@DynamoDbVersionAttribute
public Long getVersion() { return this.version; }
public void setVersion(Long version) { this.version = version; }
@DynamoDbUpdateBehavior(value = UpdateBehavior.WRITE_IF_NOT_EXISTS)
@DynamoDbAutoGeneratedTimestampAttribute
public Instant getCreatedAt() { return this.create_at; }
public void setCreatedAt(Instant time) { this.created_at = time }
@DynamoDbUpdateBehavior(value = UpdateBehavior.WRITE_ALWAYS)
@DynamoDbAutoGeneratedTimestampAttribute
public Instant getUpdatedAt() { return this.updated_at; }
public void setUpdatedAt(Instant time) { this.updated_at = time }
public String getCustName() { return this.name; }
public void setCustName(String name) { this.name = name; }
public String getEmail() { return this.email; }
public void setEmail(String email) { this.email = email; }
public Instant getRegistrationDate() { return this.regDate; }
public void setRegistrationDate(Instant registrationDate) { this.regDate = registrationDate; }
}
Possible Solution
Evaluate the update strategy on the put item call as well
Additional Information/Context
No response
AWS Java SDK version used
2.25.11
JDK version used
openjdk 17.0.12 2024-07-16
Operating System and version
MacOs 15.3.1
The text was updated successfully, but these errors were encountered:
Describe the bug
The v1 mapper would evaluate the in memory value of the field on the item before applying the auto generated time stamp.
So for example if you are using putItem with versioned updates to a previous item this would not modify the created at timestamp.
The enhanced client will alway overwrite the DynamoDBAutoGeneratedTimestamp regardless of whether it has a value in memory.
Regression Issue
Expected Behavior
var customer = Customer(id = 1, name = "John Smith")
// Put a new item
customerTable.putItem(customer);
customer = customerTable.getItem(1)
// version = 1, created_at = t0, updated_at = t0)
customer = customer.copy(email = "[email protected]")
// Put an updated item
customerTable.putItem(customer);
customer = customerTable.getItem(1)
// version = 2, created_at = t0, updated_at = t1)
Current Behavior
var customer = Customer(id = 1, name = "John Smith")
// Put a new item
customerTable.putItem(customer);
customer = customerTable.getItem(1)
// version = 1, created_at = t0, updated_at = t0)
customer = customer.copy(email = "[email protected]")
// Put an updated item
customerTable.putItem(customer);
customer = customerTable.getItem(1)
// version = 2, created_at = t1, updated_at = t1) <-- created_at is updated to the latest timestamp unconditionally.
Reproduction Steps
Possible Solution
Evaluate the update strategy on the put item call as well
Additional Information/Context
No response
AWS Java SDK version used
2.25.11
JDK version used
openjdk 17.0.12 2024-07-16
Operating System and version
MacOs 15.3.1
The text was updated successfully, but these errors were encountered: