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 am trying to save a List<CustomObject> using the @DynamoDBDocument but it gives me a DynamoDBMappingException : could not unconvert attribute.

Here is what my Entity class looks like –

@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 like –

public class Manufacturer {
    private String manufacturerName;

When using this entity and saving the values into the table it saves properly as JSON, but when retrieving it, an exception is thrown – Car[manufacturers]; could not unconvert attribute
[junit]     at
[junit]     at
[junit]     at
[junit]     at

What am I missing here, do I need to add some sort of TypeConverter or Marshaller here?

I don’t think you need a custom converter here, it looks like that DynamoDB has some issues with converting DynamoDB item into a Java object.


  • Data in DynamoDB matches your object fields. Check if types are matching as well

  • What if you define setters explicitly? Maybe Lombok is a culprit here?

Also it is odd that you do not specify a table name here:

public class Car {

A no-args constructer was required to unconvert the attribute, adding @lombok.NoArgsConstructor to the Manufacturer class solved my problem.