Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotContains is not allowing single parameter as filter #680

Open
cjewvuit opened this issue Sep 12, 2022 · 1 comment
Open

NotContains is not allowing single parameter as filter #680

cjewvuit opened this issue Sep 12, 2022 · 1 comment

Comments

@cjewvuit
Copy link

cjewvuit commented Sep 12, 2022

Expected Behavior

NotContains should return list of Acknowledgements when acknowledgements does not contains username.

public List<Acknowledgement> findAllByAcknowledgementsNotContainsAndActiveIsTrue(String username);

where Acknowledgement:

@DynamoDBTable(tableName = "acknowledgement")
@Getter @Setter @NoArgsConstructor
public class Acknowledgement {
	@Id
	@DynamoDBHashKey
	@DynamoDBAutoGeneratedKey
	private String id;

       @Field
       @DynamoDBAttribute
       private List<String> acknowledgements = new ArrayList<>();
...
}

Actual Behavior

java.lang.ClassCastException: class java.lang.String cannot be cast to class java.util.List (java.lang.String and java.util.List are in module java.base of loader 'bootstrap')
    at com.amazonaws.services.dynamodbv2.datamodeling.StandardTypeConverters$Vector$ToList$1.convert(StandardTypeConverters.java:370) ~[aws-java-sdk-dynamodb-1.12.297.jar:na]
    at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTypeConverter$DelegateConverter.convert(DynamoDBTypeConverter.java:104) ~[aws-java-sdk-dynamodb-1.12.297.jar:na]
    at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTypeConverter$NullSafeConverter.convert(DynamoDBTypeConverter.java:123) ~[aws-java-sdk-dynamodb-1.12.297.jar:na]
    at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTypeConverter$ExtendedConverter.convert(DynamoDBTypeConverter.java:83) ~[aws-java-sdk-dynamodb-1.12.297.jar:na]
    at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapperFieldModel.convert(DynamoDBMapperFieldModel.java:138) ~[aws-java-sdk-dynamodb-1.12.297.jar:na]
    at org.socialsignin.spring.data.dynamodb.repository.query.AbstractDynamoDBQueryCriteria.getPropertyAttributeValue(AbstractDynamoDBQueryCriteria.java:564) ~[spring-data-dynamodb-5.2.5.jar:5.2.5]
    at org.socialsignin.spring.data.dynamodb.repository.query.AbstractDynamoDBQueryCriteria.createSingleValueCondition(AbstractDynamoDBQueryCriteria.java:713) ~[spring-data-dynamodb-5.2.5.jar:5.2.5]
    at org.socialsignin.spring.data.dynamodb.repository.query.AbstractDynamoDBQueryCriteria.withSingleValueCriteria(AbstractDynamoDBQueryCriteria.java:485) ~[spring-data-dynamodb-5.2.5.jar:5.2.5]
    at org.socialsignin.spring.data.dynamodb.repository.query.AbstractDynamoDBQueryCreator.getItemsProperty(AbstractDynamoDBQueryCreator.java:206) ~[spring-data-dynamodb-5.2.5.jar:5.2.5]
    at org.socialsignin.spring.data.dynamodb.repository.query.AbstractDynamoDBQueryCreator.addCriteria(AbstractDynamoDBQueryCreator.java:147) ~[spring-data-dynamodb-5.2.5.jar:5.2.5]
    at org.socialsignin.spring.data.dynamodb.repository.query.AbstractDynamoDBQueryCreator.create(AbstractDynamoDBQueryCreator.java:124) ~[spring-data-dynamodb-5.2.5.jar:5.2.5]
    at org.socialsignin.spring.data.dynamodb.repository.query.AbstractDynamoDBQueryCreator.create(AbstractDynamoDBQueryCreator.java:50) ~[spring-data-dynamodb-5.2.5.jar:5.2.5]
    at org.springframework.data.repository.query.parser.AbstractQueryCreator.createCriteria(AbstractQueryCreator.java:119) ~[spring-data-commons-2.7.0.jar:2.7.0]
    at org.springframework.data.repository.query.parser.AbstractQueryCreator.createQuery(AbstractQueryCreator.java:95) ~[spring-data-commons-2.7.0.jar:2.7.0]
    at org.springframework.data.repository.query.parser.AbstractQueryCreator.createQuery(AbstractQueryCreator.java:81) ~[spring-data-commons-2.7.0.jar:2.7.0]
    at org.socialsignin.spring.data.dynamodb.repository.query.PartTreeDynamoDBQuery.doCreateQuery(PartTreeDynamoDBQuery.java:58) ~[spring-data-dynamodb-5.2.5.jar:5.2.5]
    at org.socialsignin.spring.data.dynamodb.repository.query.AbstractDynamoDBQuery.doCreateQueryWithPermissions(AbstractDynamoDBQuery.java:81) ~[spring-data-dynamodb-5.2.5.jar:5.2.5]
    at org.socialsignin.spring.data.dynamodb.repository.query.AbstractDynamoDBQuery$CollectionExecution.execute(AbstractDynamoDBQuery.java:100) ~[spring-data-dynamodb-5.2.5.jar:5.2.5]
    at org.socialsignin.spring.data.dynamodb.repository.query.AbstractDynamoDBQuery.execute(AbstractDynamoDBQuery.java:311) ~[spring-data-dynamodb-5.2.5.jar:5.2.5]
    at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:137) ~[spring-data-commons-2.7.0.jar:2.7.0]
    at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:121) ~[spring-data-commons-2.7.0.jar:2.7.0]
    at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:159) ~[spring-data-commons-2.7.0.jar:2.7.0]
    at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:138) ~[spring-data-commons-2.7.0.jar:2.7.0]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.20.jar:5.3.20]
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) ~[spring-aop-5.3.20.jar:5.3.20]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.20.jar:5.3.20]
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215) ~[spring-aop-5.3.20.jar:5.3.20]
    at com.sun.proxy.$Proxy160.findAllByAcknowledgementsNotContainsAndActiveIsTrue(Unknown Source) ~[na:na]

Steps to Reproduce the Problem

  1. Execute above code

Specifications

  • Spring Data DynamoDB Version: 5.2.5
  • Spring Data Version: Neumann-SR9 (spring-data-commons-2.7.0.jar)
  • AWS SDK Version: 1.12.297
  • Java Version: OpenJDK 64-Bit Server VM Corretto-11.0.16.9.1 (build 11.0.16.1+9-LTS, mixed mode)
  • Platform Details: Docker CE on Ubuntu 22.04

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.

@cjewvuit
Copy link
Author

Referencing this: #34 which indicates it should be fixed. What am I missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant