Skip to content

document the more common use case of SELECT based custom repo method [DATACOUCH-280] #592

Open
@spring-projects-issues

Description

@spring-projects-issues

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)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions