Unable to put an item containing a Map<String, AttributeValue> into table with map schema? #3344
-
I am trying to put an item that contains a Map<String, AttributeValue> into a dynamodb table. However, I am getting:
I would understand if this was a map of a String to a custom Object, but shouldn't DynamoDb accept an AttributeValue? For reference, here is my current code:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Hello @admbor , Thank you very much for your message. You can find a list of the supported primitive Java data types and primitive wrapper classes in DynamoDB here : https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBMapper.DataTypes.html You can use the DynamoDBTypeConverter which allows you map your own data types to a data type that is natively supported by DynamoDB. You can find documentation for this here : https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBMapper.ArbitraryDataMapping.html The error message seems underlines the need for a converter in your case. Let me know if you have any other questions. Best, Yasmine |
Beta Was this translation helpful? Give feedback.
-
The documentation provided above is for Java SDK v1. The behavior is the same in Java SDK v2. Best, Yasmine |
Beta Was this translation helpful? Give feedback.
-
Hello @admbor , Thank you very much for the clarification on your use case. You are right, an attribute converter only transforms to a set type which doesn't allow for coverage of your use case. Best, Yasmine |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
Hello @admbor ,
Thank you very much for the clarification on your use case. You are right, an attribute converter only transforms to a set type which doesn't allow for coverage of your use case.
It seems like there is no current support of the behavior you have mentioned. There has been previous mention of interest for support of this feature in #1975 and #2628. I will bring this up to the team!
Best,
Yasmine