spring-projects / spring-projects/spring-data-couchbase
document the more common use case of SELECT based custom repo method [DATACOUCH-280]
@davidkelly is already working on this.
Since Dec 31, 2020.
- Dominant language
- Java
- Stars
- 284
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Description
Simon Baslé opened DATACOUCH-280 and commented
The current snippet for creating a custom repository method implementation uses a count query and the template's older "projection" feature (NOT the spring-data-commons projections).
This is not necessarily the most straightforward use case, and it could be useful to expose both that one and a more common SELECT use case, where step 8 is more complicated to figure out:
// your own WHERE criteria:
Expression where = x("firstName = $1 and lastName = $2");
Statement statement =
//this will produce the adequate SELECT..FROM.. clause:
N1qlUtils.createSelectFromForEntity(template.getCouchbaseBucket().name())
//use the DSL to continue to the WHERE clause
.where(
//this will produce the adequate WHERE criterias in addition to your own:
//(see doc snippet for getting converter and entityInfo)
N1qlUtils.createWhereFilterForEntity(where, converter, entityInfo));
The part of the documentation in question with the count snippet is in repository.adoc, "Couchbase specifics about changing the base class".
As seen in this stackoverflow question: http://stackoverflow.com/questions/41980587/spring-data-couchbase-custom-repository-method/42009501
Affects: 2.2 GA (Ingalls)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.