aws / aws-sdk-java

The official AWS SDK for Java 1.x (In Maintenance Mode, End-of-Life on 12/31/2025). The AWS SDK for Java 2.x is available here: https://github.com/aws/aws-sdk-java-v2/
https://aws.amazon.com/sdkforjava
Apache License 2.0
4.13k stars 2.83k forks source link

Add Support for Java Time API in DynamoDB #2895

Closed belugabehr closed 1 year ago

belugabehr commented 1 year ago

Describe the feature

Add support for storing Java Time API objects, in particular: Instant and ZonedDateTime

https://github.com/aws/aws-sdk-java/blob/master/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/DynamoDBTypeConvertedTimestamp.java

https://github.com/aws/aws-sdk-java/blob/master/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/StandardTypeConverters.java

Use Case

When dealing with Date, which is not immutable, my code looks something like:

public Date getDeletedDate() { return (null == deletedDate) ? null : new Date(deletedDate.getTime()); }

public void setDeletedDate(Date deletedDate) {
  this.deletedDate = (null == deletedDate) ? null : new Date(deletedDate.getTime());
}

Proposed Solution

Add support Java Time API which includes immutable objects and is over-all a better solution in Java.

Other Information

No response

Acknowledgements

AWS Java SDK version used

1

JDK version used

11

Operating System and version

Amazon Linux 2

debora-ito commented 1 year ago

Hi @belugabehr you might have noticed this already, but Instant and ZonedDateTime are already supported in the SDK V2 DynamoDB Enhanced Client.

The team is focused in working in V2 features right now, so this request would have very low priority. Because of this, and because it's already supported in V2, I'll go ahead and close this.

github-actions[bot] commented 1 year ago

COMMENT VISIBILITY WARNING

Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

belugabehr commented 1 year ago

@debora-ito Thanks. I've moved my focus to SDK V2 based on your advice.