Closed nicsl0s closed 8 years ago
You are using as primary key a RANGE+HASH. You need to do the following
@Id
referencing a custom "key" class@DynamoDBRangeKey
and @DynamoDBHashKey
respectively.Repository
have to be updated to the new "key" class.You can find an example here in Playlist
/ PlaylistId
: https://github.com/michaellavelle/spring-data-dynamodb/tree/master/src/test/java/org/socialsignin/spring/data/dynamodb/domain/sample
The background for this mumbojumbo is that spring-data requires to have a dedicated entity representing the key. As the Repository.find()
method takes exactly one argument - T
from your specific derived repository. Therefore the two fields, which constitute the key, have to be wrapped up in a single entity - the "key class" depicted above.
Ok, that helped. thx
I'm trying to implement a service method to always return the latest item from a dynamoDB table by id. I'm using spring boot 1.2.7. with spring-data-dynamodb 1.0.2.RELEASE. My DynamoDB table class looks like this:
My repos look like this:
Whenever I the application it, I get error:
I changed my DynamoDB table class to add the @Id annotation
Now get the following error:
How to solve this?