DynamoDBMappingException: class java.util.ArrayList not annotated with @DynamoDBTable

Viewed 1001

Although, @DynamoDBTable annotation is there still getting exception when ever I am doing batchsave and also why IntelliJ inspection telling DynamoDBMapperConfig is deprecated.

Although, @DynamoDBTable annotation is there still getting exception when ever I am doing batchsave and also why IntelliJ inspection telling DynamoDBMapperConfig is deprecated.

object  TestDDbOperation{
  final val EMPLOYEE_TABLE_NAME = "TestAnytimepayEmployeeJobData"
  final val EMPLOYEE_ID_HASH_ATTRIBUTE = "employeeId"
  final val EMPLOYEE_JOB_DATA_LIST_ATTRIBUTE = "employeeJobDataList"
  final val LAST_UPDATE_TIME_ATTRIBUTE = "lastUpdatedTime"
}

@DynamoDBTable(tableName = TestDDbOperation.EMPLOYEE_TABLE_NAME)
class TestDDbOperation {
  import TestDDbOperation._

  @BeanProperty
  @DynamoDBHashKey(attributeName = EMPLOYEE_ID_HASH_ATTRIBUTE)
  var employeeId: String = _

  @BeanProperty
  @DynamoDBAttribute(attributeName = LAST_UPDATE_TIME_ATTRIBUTE)
  var lastUpdatedTime: Long = _
}

DDbOperation:

    def batchSaveInDDB[T](employeeJobDataList: ArrayList[T]): List[FailedBatch] =
     AWSSession.dynamoDBMapper.batchSave(employeeJobDataList, new 
     DynamoDBMapperConfig(DynamoDBMapperConfig.SaveBehavior.UPDATE))
1 Answers

I had the same issue with batchDelete. I could solved it calling to the batchWrite method like this:

dynamoDBMapper.batchWrite(Collections.emptyList(), objectsToDelete, config)

For batch save will be:

dynamoDBMapper.batchWrite(objectsToSave, Collections.emptyList(), config)
Related