java - Cannot load data from DynamoDB due to an attribute of type List<Object> which is not able to get unconverted and was saved using @DynamoDBDocument -
i trying save list<customobject>
using @dynamodbdocument gives me dynamodbmappingexception : not unconvert attribute.
here entity class looks -
@lombok.data @dynamodbtable(tablename = "cartable") public class car { @dynamodbhashkey(attributename = "name") private carname; @dynamodbrangekey(attributename = "model") private carmodel; @dynamodbattribute(attributename = "manufacturers") private list<manufacturer> manufacturers; }
the manufacturer class looks -
@lombok.data @dynamodbdocument public class manufacturer { @dynamodbattribute private string manufacturername; }
when using entity , saving values table saves json, when retrieving it, exception thrown -
com.amazonaws.services.dynamodbv2.datamodeling.dynamodbmappingexception: car[manufacturers]; not unconvert attribute @ com.amazonaws.services.dynamodbv2.datamodeling.dynamodbmappertablemodel.unconvert(dynamodbmappertablemodel.java:271) [junit] @ com.amazonaws.services.dynamodbv2.datamodeling.dynamodbmapper.privatemarshallintoobject(dynamodbmapper.java:456) [junit] @ com.amazonaws.services.dynamodbv2.datamodeling.dynamodbmapper.load(dynamodbmapper.java:422) [junit] @ com.amazonaws.services.dynamodbv2.datamodeling.dynamodbmapper.load(dynamodbmapper.java:433) [junit] @ com.amazonaws.services.dynamodbv2.datamodeling.abstractdynamodbmapper.load(abstractdynamodbmapper.java:85)
what missing here, need add sort of typeconverter or marshaller here?
i don't think need custom converter here, looks dynamodb has issues converting dynamodb item java object.
check:
data in dynamodb matches object fields. check if types matching well
what if define setters explicitly? maybe lombok culprit here?
also odd not specify table name here:
@dynamodbtable(tablename) public class car { ... }
Comments
Post a Comment