Skip to content

@ScanConsistency ignored for n1ql queries [DATACOUCH-605] #913

Closed
@spring-projects-issues

Description

@spring-projects-issues

blitzenzzz opened DATACOUCH-605 and commented

A Repository shaped like this:

@Repository
public interface ThingRepo extends CouchbaseRepository<Thing, String> {
    @Query("#{#n1ql.selectEntity} WHERE #{#n1ql.filter} AND secondaryId = $secondaryId")
    @ScanConsistency(query = QueryScanConsistency.REQUEST_PLUS)
    Optional<Thing> getBySecondaryId(String secondaryId);
}

Will not attempt to look at the scan consistency annotation. It will also ignore it if you leave the annotation off and rely on the N1qlQueryCreator. See N1qlRepositoryQueryExecutor. The consistency will always be the default unbounded. The @WithConsistency annotation is also ignored.

I found this while migrating from 3.x to 4.0.3 and executing unit tests that use "save" to persist an entity and then call something similar to "getBySecondaryId" on the following line.

Documentation reference - https://docs.spring.io/spring-data/couchbase/docs/current/reference/html/#couchbase.repository.consistency


Affects: 4.0.3 (Neumann SR3)

Backported to: 4.0.5 (Neumann SR5)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions