Error while writing custom DynamoDB query in springBoot

Viewed 53

I am trying to query dynamoDB table ProductInfo based on a field cost.

When I am executing

aws dynamodb execute-statement --statement "SELECT * FROM ProductInfo WHERE cost='1000'" --endpoint-url http://localhost:8000"

from cli, I am getting correct output but when I am trying from springboot I am getting the error

"AmazonDynamoDBException: Can not use both expression and non-expression parameters in the same request"

For project configuration I have followed this link

My repository looks like below:

import org.socialsignin.spring.data.dynamodb.repository.EnableScan;
import org.socialsignin.spring.data.dynamodb.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;

@EnableScan
public interface ProductInfoRepository extends CrudRepository<ProductInfo, String> {

  @Query(fields = "select * from ProductInfo where cost = :cost")
  List<ProductInfo> findAllProductByCost(@Param("cost") String cost);
}
0 Answers
Related