When I used enhanced client to put but it throws class cast exception.
DynamoDbTable<Tableclass> recordTable = enhanceClient.table(tableName, Tableclass.class); Tableclass tableclass = new Tableclass(); tableclass.setid(1); tableclass.setname("myname"); recordTable.putItem(tableclass);
It gives me error java.lang.ClassCastException: com.db.dynamo.Tableclass cannot be cast to com.db.dynamo.Tableclass
Advertisement
Answer
This worked for me SpringBoot – Java AWS SDK 2 DynamoDB Enhanced Client and devtools problem
So basically the issue was with spring dev tools and its class loader(2 in number), so you can either remove it or move dynamo to the same class loader.