2017-09-13 6 views
0

メンバー変数として文字列/ intがあり、タイプがPhotoのメンバー変数を持つEntityクラスがあります。私は、Entityオブジェクトを記述しようとすると@DBDocumentアノテーションを使用しているときにDynamodbマッパーが読み込めません

@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; 
    } 
} 

、私は写真の種類はマップ(M)として保存されて見ることができますように私は写真のタイプを定義しています。

しかし、私はダイナモから同じエンティティを読み込むしようとすると、それが例外を与える:

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

私は写真用unconvert変換/を定義する必要があれば、@DBDocument注釈の使用は何です。テーブルからデータを逆シリアル化することもできると思っていました。

助けてください!

答えて

0

私は写真

public Photo() { } 
のデフォルトのctorのを定義する必要がありました
関連する問題