spring-projects / spring-projects/spring-data-couchbase
Auditing does not work for Couchbase records
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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