Skip to content

Fix Couchbase auditing for immutable entities, including Java records - #2151

Open
kaliy wants to merge 2 commits into
spring-projects:mainfrom
kaliy:fix-auditing-immutable-entities
Open

Fix Couchbase auditing for immutable entities, including Java records#2151
kaliy wants to merge 2 commits into
spring-projects:mainfrom
kaliy:fix-auditing-immutable-entities

Conversation

@kaliy

@kaliy kaliy commented Aug 12, 2026

Copy link
Copy Markdown

Closes #2152

When auditing an entity, Spring Data can return a new instance with its audit fields set. The Couchbase callback ignored that returned instance.

This does not affect normal mutable classes because their fields are updateddirectly. For records and classes with final fields, however, the audit dates were not saved.

Use AuditingEntityCallback as the single auditing mechanism. It keeps the audited replacement instance and avoids running auditing twice for mutable entities. This follows the original implementation discussion: #1102 (comment)


  • You have read the Spring Data contribution guidelines.
  • There is a ticket in the bug tracker for the project in our JIRA I believe it should be a github issue, not jira. Created Auditing does not work for Couchbase records #2152
  • You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.
  • You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 12, 2026
Signed-off-by: Artur Kalimullin <kalimullin@gmail.com>
@kaliy
kaliy force-pushed the fix-auditing-immutable-entities branch 8 times, most recently from 80f26fb to b5ae278 Compare August 13, 2026 13:01
Signed-off-by: Artur Kalimullin <kalimullin@gmail.com>
@kaliy
kaliy force-pushed the fix-auditing-immutable-entities branch from b5ae278 to beeb576 Compare August 13, 2026 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auditing does not work for Couchbase records

2 participants