Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Aug 19, 2020 · 4 comments
Closed
Assignees
Labels
in: repository Repositories abstraction type: bug A general bug

Comments

@spring-projects-issues
Copy link

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)

@spring-projects-issues
Copy link
Author

blitzenzzz commented

This bug is similar to https://jira.spring.io/browse/DATACOUCH-585, but not identical

@spring-projects-issues
Copy link
Author

Michael Reiche commented

I believe this is fixed with DATACOUCH-588, but this hasn't been merged yet.

#249

@spring-projects-issues
Copy link
Author

blitzenzzz commented

I see the change to ExecutableFindByQueryOperationSupport. I think those five lines would fix it

@spring-projects-issues
Copy link
Author

Michael Reiche commented

This is the pull-request for the fix that was eventually merged -

#267

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: repository Repositories abstraction type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants