Open
Description
When I invoke a repository method that makes a key search in dynamo:
"{"TableName":"music","Key":{"artist":{"S":"Djavan"},"title":{"S":"Tempo"}},"ConsistentRead":false}"
this is aws output:
"{}"
And when i invoke another methos that makes a find using sortKey start with:
this is sent to aws:
"{"TableName":"music","ConsistentRead":true,"KeyConditions":{"artist":{"AttributeValueList":[{"S":"Djavan"}],"ComparisonOperator":"EQ"},"title":{"AttributeValueList":[{"S":"Tempo"}],"ComparisonOperator":"BEGINS_WITH"}},"ScanIndexForward":true}"
and this is the return:
"{"Count":0,"Items":[],"ScannedCount":0}"
Steps to Reproduce the Problem
Using a entity named Music
@DynamoDBTable(tableName = "music")
data class Music(
@get:DynamoDBHashKey(attributeName = "artist")
var artist: String? = null,
@get:DynamoDBRangeKey(attributeName = "title")
var title: String? = null,
var genre: String? = null
) {
@Id
private var id: MusicId? = null
get() = MusicId(artist, title)
}
@DynamoDBDocument
data class MusicId(
@field:DynamoDBHashKey(attributeName = "artist")
var artist: String? = null,
@field:DynamoDBRangeKey(attributeName = "title")
var title: String? = null
) : Serializable
And a repository
interface MusicRepository : CrudRepository<Music, MusicId> {
fun findByArtistAndTitle(artist: String, title: String): List<Music>
fun findByArtistAndTitleStartingWith(artista: String, sortKey: String): List<Music>
}
And when i invoke:
@PostConstruct
fun init() {
println(musicRepository.findByArtistAndTitleStartingWith("Djavan", "Eu te devoro").joinToString())
}
the log show's me the call to AWS as i showed above
Specifications
- Lib: https://github.com/boostchicken/spring-data-dynamodb
- Spring Data DynamoDB Version: 5.2.5
- Spring Data Version: Doesn't used
- Spring Boot Starter Web Version: 2.3.4.RELEASE
- AWS SDK Version: 1.11.573
- Java Version: 11
- Platform Details: Windows
Stackoverflow question: https://stackoverflow.com/questions/65996950/why-spring-data-dynamodb-are-returning-a-list-with-null-element-instead-a-empty
Someone know if is there a clean way to guarantee that the dynamo repo will never return a list that only accepts non null elements, with null elements?
Metadata
Metadata
Assignees
Labels
No labels