Я пытаюсь удалить данные из моей таблицы DynamoDB на основе идентификатора (HashKey).
Ассоциация. java
@DynamoDBTable(tableName = "Association")
public class Association {
private String id;
private String name;
private String adminName;
private String email;
private String url;
private String contactNumber;
private String password;
public Association() { }
public Association(String name, String adminName, String email, String url,
String contactNumber, String password) {
this.name = name;
this.adminName = adminName;
this.email = email;
this.url = url;
this.contactNumber = contactNumber;
this.password = password;
}
public Association(String id, String name, String adminName, String email, String url,
String contactNumber, String password) {
this.id = id;
this.name = name;
this.adminName = adminName;
this.email = email;
this.url = url;
this.contactNumber = contactNumber;
this.password = password;
}
@DynamoDBHashKey(attributeName = "Id")
@DynamoDBAutoGeneratedKey
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@DynamoDBAttribute(attributeName="Name")
public String getName() { return name; }
public void setName(String name) { this.name = name; }
@DynamoDBAttribute(attributeName="AdminName")
public String getAdminName() { return adminName; }
public void setAdminName(String adminName) { this.adminName = adminName; }
@DynamoDBAttribute(attributeName="Email")
public String getEmail() { return email; }
public void setEmail(String email) { this.email = email; }
@DynamoDBAttribute(attributeName="Url")
public String getUrl() { return url; }
public void setUrl(String url) { this.url = url; }
@DynamoDBAttribute(attributeName="ContactNumber")
public String getContactNumber() { return contactNumber; }
public void setContactNumber(String contactNumber) { this.contactNumber = contactNumber; }
@DynamoDBAttribute(attributeName="Password")
public String getPassword() { return password; }
public void setPassword(String password) { this.password = password; }
}
AssociationRepository. java: -
private AmazonDynamoDBClient getDynamoDBClient(){
AmazonDynamoDBClient client = new AmazonDynamoDBClient();
client.setRegion(Region.getRegion(REGION));
client.setEndpoint(EndPoint);
return client;
}
private void deleteAssociation(String id) {
try {
DynamoDBConfig dynamoDBConfig = new DynamoDBConfig();
DynamoDBMapper mapper = new DynamoDBMapper(dynamoDBConfig.getDBClient());
Association associationToDelete = new Association();
associationToDelete.setId(id);
// Delete the item.
mapper.delete(associationToDelete);
} catch (Exception exception) {
System.out.println(exception);
throw exception;
}
}
Я получаю следующую ошибку : -
com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMappingException: No method annotated with interface com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBRangeKey for class class Association
Я искал в AWS документах для этого, но не смог найти решения, которое бы это исправило. Кто-нибудь из вас когда-либо сталкивался с этой проблемой?