spring-projects / spring-projects/spring-data-couchbase

Auditing does not work for Couchbase records

Open
#2,152 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
284
Forks
197
PR merge metrics
No merged PRs in 30d

Description

Auditing fields are not saved for Couchbase entities declared as Java records.

For example:

@Document
record AuditedRecord(
        @Id String id,
        @CreatedDate Instant createdDate,
        @LastModifiedDate Instant lastModifiedDate) {}

When saving a new record with Couchbase auditing enabled:

var saved = repository.save(new AuditedRecord(null, null, null));

the record read back from Couchbase has null audit fields:

var found = repository.findById(saved.id()).orElseThrow();

assertThat(found.createdDate()).isNotNull(); // fails
assertThat(found.lastModifiedDate()).isNotNull(); // fails 

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the Java record, @CreatedDate and @LastModifiedDate fields, and the repository.save/findById flow shown here. Trace the Couchbase auditing and record-mapping entry points to determine why the fields remain null. Done means both audit fields are populated after saving and remain non-null when the record is read back.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.