I am trying to pass a parameter to custom query but it is not working.
My class is like this:
@Repository public interface CarRepository extends CouchbaseRepository<CarDocument, String> {
@Query(
value = "#{#n1ql.selectEntity} #{#n1ql.bucket} where cars.`:#{#carId}` is not missing; ")
List<CarDocument> getCarDocumentsByCarId(@Param("carId")Integer carId);
}
The returned value is null. So it is not working. what am I doing wrong?
Here's an example of how you can pass parameters to a Couchbase query:
The placeholder $1 is used to represent the first parameter passed to the method.
When you call the findByUsername method and pass a username as an argument, it will be substituted in the query at the placeholder's position.