derjust/spring-data-dynamodb

TableNameResolver does not work with @DynamoDBIndexHashKey

Opened this issue · 3 comments

Expected Behavior

TableNameResolver should be called for every query

Actual Behavior

TableNameResolver is not called for secondary indexes

Steps to Reproduce the Problem

  1. Create a GSI
  2. Add @DynamoDBIndexHashKey in entity class
  3. Add table name resolver and add some prefix
  4. Run the query table name resolver wont be called

Specifications

implementation("com.amazonaws:aws-java-sdk-dynamodb:1.11.914")
implementation("com.amazonaws:aws-java-sdk-sts:1.11.914")
implementation("com.github.derjust:spring-data-dynamodb:5.1.0")

ref: #263 (comment)

@EnableDynamoDBRepositories(dynamoDBMapperConfigRef = "dynamoDBMapperConfig")

Above workaround works for me.

I'm trying to prefix the GSI name with env.name so that the GSI name is built dynamically, like separate names for the different environments - dev-{gsi-name}, qa-{gsi-name}. The DynamoDBMapperConfig it appears is capable only of overriding the table name (annotated by @DynamoDBTable), but the same does not work for the GSI. I've tried @EnableDynamoDBRepositories(dynamoDBMapperConfigRef = "dynamoDBMapperConfig") this but this also does not work re: overriding the GSI name.

Any suggestions on how we could possibly accomplish this ?

I'm using: implementation 'com.github.derjust:spring-data-dynamodb:5.1.0'

@derjust