forked from michaellavelle/spring-data-dynamodb
-
Notifications
You must be signed in to change notification settings - Fork 139
Open
Description
I have a main Player table and two gsi tables demonstrated below:
Player
Partition Key - PlayerId
Attribute - ScoreType1
Attribute - ScoreType2
Attribute - IsoCountryCode
GSI-1
Partition Key - Country
Sort Key - ScoreType1
Attribute - PlayerId
GSI-2
Partition Key Country
Sort Key ScoreType2
Attribute PlayerId
I wrote entity class by giving both GSI's names into globalSecondaryIndexNames
,
@DynamoDBTable(tableName = "Player")
public class PlayerDynamoEntity {
@DynamoDBHashKey(attributeName = "PlayerId")
private String player;
@DynamoDBAttribute(attributeName = "CountryCode")
@DynamoDBIndexHashKey(attributeName = "CountryCode",
globalSecondaryIndexNames = {"GSI-1", "GSI-2"})
private String countryCode;
@DynamoDBAttribute(attributeName = "Score-1")
@DynamoDBIndexRangeKey(attributeName = "Score-1", globalSecondaryIndexName = "GSI-1")
private String score1;
@DynamoDBAttribute(attributeName = "Score-2")
@DynamoDBIndexRangeKey(attributeName = "Score-2", globalSecondaryIndexName = "GSI-2")
private String score2;
and repository:
@EnableScan
public interface PlayerRepository extends CrudRepository<PlayerDynamoEntity, String> {
Page<PlayerDynamoEntity> findByCountryCode(String countryCode, Pageable pageable);
}
Hence the countryCode is the hash for both GSI tables, Whenever I write ***ByCountryCode it automatically behaves like I only query for GSI-1. How can I access to second GSI table?
I expected to specify the GSI somehow but I couldn't find it.
Metadata
Metadata
Assignees
Labels
No labels