Uploaded image for project: 'Spring Data Couchbase'
  1. Spring Data Couchbase
  2. DATACOUCH-605

@ScanConsistency ignored for n1ql queries

    XMLWordPrintable

    Details

      Description

      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

        Attachments

          Activity

            People

            Assignee:
            mikereiche Michael Reiche
            Reporter:
            blitzenzzz blitzenzzz
            Last updater:
            Spring Issues Spring Issues
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: