Skip to content

findById of CouchbaseTemplate does not involve getAndTouch entities [DATACOUCH-674] #982

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 Dec 11, 2020 · 1 comment · Fixed by #1196
Assignees
Labels
type: bug A general bug

Comments

@spring-projects-issues
Copy link

jorgerod opened DATACOUCH-674 and commented

Hi

FindById method does not involve touchOnRead entities, that is, internally, it only uses the get method and does not give the possibility of being able to use the getAndTouch method

 

  • spring-data-couchbase 3.2.9-RELEASE. (Couchbase.java): 
  @Override
  public <T> T findById(final String id, Class<T> entityClass) {
    final CouchbasePersistentEntity<?> entity = mappingContext.getRequiredPersistentEntity(entityClass);
    RawJsonDocument result = execute(new BucketCallback<RawJsonDocument>() {
      @Override
      public RawJsonDocument doInBucket() {
        if (entity.isTouchOnRead()) {
          return client.getAndTouch(id, entity.getExpiry(), RawJsonDocument.class);
        } else {
          return client.get(id, RawJsonDocument.class);
        }
      }
    });

    return mapToEntity(id, result, entityClass);
  }

 

  • spring-data-couhbase 4.1.1: (ReactiveFindByIdOperationSupport.ReactiveFindByIdSupport.java)
		@Override
		public Mono<T> one(final String id) {
			return Mono.just(id).flatMap(docId -> {
				GetOptions options = getOptions().transcoder(RawJsonTranscoder.INSTANCE);
				if (fields != null && !fields.isEmpty()) {
					options.project(fields);
				}
				return template.getCollection(collection).reactive().get(docId, options);
			}).map(result -> template.support().decodeEntity(id, result.contentAs(String.class), result.cas(), domainType))
                       ....

 


Affects: 4.2 M1 (2021.0.0), 4.1.2 (2020.0.2)

@spring-projects-issues
Copy link
Author

jorgerod commented

Hi Michael Reiche

I have seen that the status of the issue is In Progress.
Are you doing it or do you want us to contribute?

@spring-projects-issues spring-projects-issues added the type: bug A general bug label Dec 31, 2020
@mikereiche mikereiche changed the title findById of CouchbaseTemplate does not involve touchOnRead entities [DATACOUCH-674] findById of CouchbaseTemplate does not involve getAndTouch entities [DATACOUCH-674] Aug 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
2 participants