Skip to content

Annotation @Query does not support Non-String Type #526

@qqyycom

Description

@qqyycom

@query(filterExpression = "#field = :value", consistentReads = QueryConstants.ConsistentReadMode.EVENTUAL,
expressionMappingNames = {@ExpressionAttribute(key = "#field", value = "key")},
expressionMappingValues = {@ExpressionAttribute(key = ":value", parameterName = "key")})
List findByUidAndDeviceId(@param("uid") String uid, @param("device_id") String deviceId, @param("key") Integer key);

Expected Behavior

I want QueryFilter with Number type, But It doesn't support

Actual Behavior

Throws ClassCastException

which happens in {@DynamoDBEntityWithHashAndRangeKeyCriteria} line 216

queryExpression.addExpressionAttributeValuesEntry(value.key(), new AttributeValue(mappedExpressionValues.get(value.parameterName())));

the AttributeValue constructor only support String type value

Steps to Reproduce the Problem

Specifications

  • Spring Data DynamoDB Version: 5.2.5
  • Spring Data Version: 2.5.2
  • AWS SDK Version:
  • Java Version: 8
  • Platform Details:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions