spring-data-dynamodb icon indicating copy to clipboard operation
spring-data-dynamodb copied to clipboard

Add support for @AccessType(AccessType.Type.FIELD)

Open ksklodowski-transactionlink opened this issue 2 years ago • 0 comments

Expected Behavior

I would like to remove setters and getters from entity class and replace them with annotation: @AccessType(AccessType.Type.FIELD)

Actual Behavior

com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMappingException: Example; no mapping for HASH key

Steps to Reproduce the Problem

  1. Create class with annotations
@DynamoDBTable(tableName = "ExampleTable")
@NoArgsConstructor(access = PRIVATE)
@AllArgsConstructor(access = PRIVATE)
@AccessType(FIELD)
public class Example {

    @DynamoDBHashKey
    private UUID id;
    private UUID taskId;
  
 }
  1. Try to save entity through the repository
@Repository
interface DynamoDbExampleRepository extends CrudRepository<Example, UUID> {

    Optional<Example> findByTaskId(final UUID taskId);

}

Specifications

  • Spring Data DynamoDB Version: 5.2.5
  • Spring Data Version: 2.4.0
  • AWS SDK Version: 1.11.951

All those information are logged by org.socialsignin.spring.data.dynamodb.repository.support.DynamoDBRepositoryFactory on INFO level on startup. Or use java -version and mvn dependency:tree | grep -E 'spring|aws' to provide those version numbers.