2017-09-13 1 views
0

J'ai une classe Entity qui a des chaînes/ints en tant que variable membre et une variable membre dont le type est Photo. J'ai défini le type de photo comme:Le mappeur dynamodb ne peut pas lire lors de l'utilisation de l'annotation @DBDocument

@DynamoDBDocument 
public static class Photo { 
    @DynamoDBAttribute(attributeName = "url") 
    public String getUrl() { 
     return url; 
    } 

    @DynamoDBAttribute(attributeName = "width") 
    public Integer getWidth() { 
     return width; 
    } 

    @DynamoDBAttribute(attributeName = "height") 
    public Integer getHeight() { 
     return height; 
    } 

    public void setUrl(String url) { 
     this.url = url; 
    } 

    public void setWidth(Integer width) { 
     this.width = width; 
    } 

    public void setHeight(Integer height) { 
     this.height = height; 
    } 

    private String url; 
    private Integer width; 
    private Integer height; 

    public Photo(String url, Integer width, Integer height) { 
     this.url = url; 
     this.width = width; 
     this.height = height; 
    } 
} 

Lorsque je tente d'écrire un objet entité, je peux voir le type de photo est stockée sous la forme d'une carte (M).

Mais quand je lis essaie de dynamo la même entité, elle donne exception:

com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMappingException: PostingPhotoEntity[detail]; could not unconvert attribute 

Si je dois définir le convert/unconvert pour photo, quelle est l'utilisation de l'annotation @DBDocument. J'avais pensé qu'il pouvait aussi désérialiser les données de la table.

Aidez s'il vous plaît!

Répondre

0

je dû définir un cteur par défaut pour Photo

public Photo() { }