我有一个复杂的物体 Test
在实体类中 Item
.
@AllArgsConstructor
@Getter
public enum TestStatus {
TO_RUN("To Run"),
RUNNING("Running"),
PASSED("Passed"),
FAILED("Failed");
public static TestStatus fromValue(String value) {
//...implementation
}
private final String value;
}
@Data
@ToString
@Accessors(chain = true)
@DynamoDBFlattened(attributes = {
@DynamoDBAttribute(attributeName = "test.task.id", mappedBy = "id"),
@DynamoDBAttribute(attributeName = "test.task.status", mappedBy = "status")
})
public class TestTask {
private String id;
@DynamoDBTypeConvertedEnum
private TestStatus status;
}
@Data
@ToString
@Accessors(chain = true)
@DynamoDBFlattened(attributes = {
@DynamoDBAttribute(attributeName = "test.suite.name", mappedBy = "name"),
@DynamoDBAttribute(attributeName = "test.suite.version", mappedBy = "version")
})
public class TestSuite {
private String name;
private String version;
}
@Data
@ToString
@Accessors(chain = true)
public class Test {
private TestSuite suite;
private TestTask task;
}
@Data
@ToString
@Accessors(chain = true)
@DynamoDBTable(tableName = "com.example.item")
public class Item {
private String name;
private Test test; // This is a complex object as structure given above.
}
On the call of dynamoDBMapper.save(item); getting exception.
@Repository
@RequiredArgsConstructor
public class DynamoDBItemRepository implements ItemRepository {
//...
@Override
public Item save(Item item) {
dynamoDBMapper.save(item); // Getting DynamoDBMappingException: not supported; requires @DynamoDBTyped or @DynamoDBTypeConverted
return item;
}
//...
}
我得到了例外
com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMappingException: not supported; requires @DynamoDBTyped or @DynamoDBTypeConverted
at com.amazonaws.services.dynamodbv2.datamodeling.StandardModelFactories$Rules$NotSupported.set(StandardModelFactories.java:664) ~[aws-java-sdk-dynamodb-1.11.578.jar:?]
我错过了什么?请帮帮我!
暂无答案!
目前还没有任何答案,快来回答吧!