aws / aws-sdk-java-v2

The official AWS SDK for Java - Version 2
Apache License 2.0
2.15k stars 825 forks source link

Persist-only property support for DynamoDB Enhanced client #3913

Open chrylis opened 1 year ago

chrylis commented 1 year ago

Describe the feature

The Enhanced client should identify JavaBeans properties based on getter methods. When a setter method is not present, the client should persist the property into DynamoDB but should not attempt to set the property on read. (If necessary, an explicit directive to do this such as Jackson's @JsonProperty(access) would be okay.)

Use Case

I have a table with a large number of derived properties for indexing. Currently, the Enhanced client fails to correctly identify properties that have only getter methods and not setter methods. As the use of derived properties to paste together main properties is the standard method of creating indexes for DDB, it would be helpful not to have to include dummy setters.

Proposed Solution

Modify BeanTableSchema#isMappableProperty not to exclude properties without setters, and allow missing setters to be interpreted as "no-op".

Other Information

No response

Acknowledgements

AWS Java SDK version used

2.19.25

JDK version used

openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9) OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)

Operating System and version

Gentoo Linux

debora-ito commented 1 year ago

Acknowledged.

Community note: please vote by adding a 👍 reaction to the original issue to help us prioritize this request.