The error statement is as follows.
java.lang.IllegalArgumentException: A sort key value was supplied for an index that does not support one. Index: $PRIMARY_INDEX
The getter / setter definition for an attribute is incorrect. (Nth defeat ...)
Set the appropriate getters and setters. Specifically, check the following two points.
--Method name --Argument type
In the case of the author, it occurred in the following form.
@DynamoDbBean
@Setter
public class Foo {
private String name;
private String date;
@DynamoDbAttribute("name")
public String getName() {
return name;
}
@DynamoDbAttribute("date")
public String getDate() {
return date;
}
public setDate(Date date) {
this.date = new SimpleDateFormat("yyyy-MM-dd").format(date);
}
}
The cause is Foo # setDate (Date).
You need to set getters and setters for the table metadata.
When set with the @DynamoDbAttribute annotation, the method name and argument type must match the field.
The field date is defined as String type, but the setter has received Date type.
Since the signature is different from the setter generated by Lombock's @Setter annotation, it can coexist, andFoo # setDate (String)is also defined.
However, it seems that Foo # setDate (Date) is picked up as the metadata of the table.
For some reason, it seems that an error occurs when trying to access the index table.
Recommended Posts