Ниже приведен код, в котором я помещаю адрес для двух разных ключей, но я получаю только одно значение ключа, т.е. для «ADDRESS_HOME».
Я не знаю, заменен ли «ADDRESS_MAIL» или что-то еще.
var homeAddress = new Address
var mailAddress = new Address
homeAddress.setAddressLine1(recordString(EmployeeJobMetadata.homeAddressLine1.id))
mailAddress.setAddressLine1(recordString(EmployeeJobMetadata.mailAddressLine1.id))
var addressMailMap = new HashMap[String, Address]
addressMailMap.put(mailAddress.ADDRESS_MAIL, mailAddress)
var homeAddressMap = new HashMap[String, Address]
homeAddressMap.put(homeAddress.ADDRESS_HOME, homeAddress)
employeePersonalData.setAddressMap(addressMailMap)
employeePersonalData.setAddressMap(homeAddressMap)
Класс Pojo:
@DynamoDBDocument
class EmployeePersonalData {
@BeanProperty
var firstName: String = _
@BeanProperty
var lastName: String = _
@BeanProperty
var addressMap: Map[String, Address] = _
}