DynamoDb error: converter not found for EnhancedType(java.util.Optional)
See original GitHub issueDescribe the issue
I’m trying to write to DynamoDb my object model with an Optional field, but it does not work. If I exclude the Optional field from my model I can successfully save it to DynamoDb.
Steps to Reproduce
private final String notificationText;
public Optional<String> getNotificationText() {
return Optional.ofNullable(notificationText);
}
public void setNotificationText(Optional<String> notificationText) {
// Do nothing, this is a derived attribute
}
Current behavior
I’m obtaining this error:
java.lang.IllegalStateException: Converter not found for EnhancedType(java.util.Optional)
I’m trying to create my custom ConvertProvider implementing AttributeConverterProvider and using the OptionalAttributeConverter but I don’t understand how to use it. Can someone help me?
AWS Java SDK version used
dynamodb-enhanced version 2.17.102
JDK version used
openjdk version “1.8.0_312”
Operating System and version
Linux 5.4.0-91-generic #102-Ubuntu
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Enhanced Dynamodb not support List<CustomObject> type?
In my table schema there is List property,try to save the object,got following error Converter not found for EnhancedType(java.util.
Read more >Dynamodb attribute converter provider for enhanced type ...
I have a type which is extending HashMap<String, String> . As per the documentation here, it is possible to add a custom converter...
Read more >DynamoDB Enhanced Client for Java: Missing Setters Cause ...
The AWS SDK v2 for Java's DynamoDB Enhanced Client requires setters for every attribute. Missing the setter for a given attribute may cause ......
Read more >Mapping arbitrary data - Amazon DynamoDB
Map arbitrary data to the Amazon DynamoDB types using the DynamoDBMapper class of the AWS SDK for Java.
Read more >How to use Enhanced DynamoDB AWS sdk for Java v2 in ...
In this post you will see how to make use of this new sdk in a spring boot application to save data in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Following your advices I’ve created a
CustomAttributeConverterProviderwithOptionalAttributeConverter<String>and now it works! I’ve updated my demo project for any future references: https://github.com/marcogramy/dynamodbdemoThank you for your help!
⚠️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.