Open bg-orhanocak opened 1 year ago
I have a main Player table and two gsi tables demonstrated below:
Partition Key - PlayerId Attribute - ScoreType1 Attribute - ScoreType2 Attribute - IsoCountryCode
Partition Key - Country Sort Key - ScoreType1 Attribute - PlayerId
Partition Key Country Sort Key ScoreType2 Attribute PlayerId
I wrote entity class by giving both GSI's names into globalSecondaryIndexNames ,
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.
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
,and repository:
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.