spring custom query with cosmos template#10
spring custom query with cosmos template#10TheovanKraay wants to merge 1 commit intoAzure-Samples:mainfrom
Conversation
kushagraThapar
left a comment
There was a problem hiding this comment.
Requesting some changes!
I am curious to know the use case for executing this simple custom query through cosmosTemplate. This query can be easily executed through @Query annotation. There is no value in autowiring CosmosTemplate if not needed. It might add additional complexity.
One use case that I have constantly seen and asked for is how to construct query through Criteria object in spring-data-cosmos, which is also a pretty generic thing to do in spring-data. Criteria class should be able to define what all a customer needs for a query. And then let spring-data-cosmos SDK execute that criteria in a query form.
Some examples are here -
Additional PR for some more details on criteria development and usage - Azure/azure-sdk-for-java#30379
|
Fair point, I will come up with a query that cannot be executed using @query or Criteria. Point is, customers want to be able to just inject the SQL API query rather than follow the Criteria or @query pattern in some cases (because it doesn't support what they want, or even because it is cumbersome). |
Purpose
Show example of how to run custom queries using the raw Cosmos DB SQL API query syntax with CosmosTemplate
Does this introduce a breaking change?
Pull Request Type
What kind of change does this Pull Request introduce?
How to Test
What to Check
Verify that the following are valid
Other Information