Skip to content

Conversation

@mehdi0933
Copy link

Description

This PR addresses issue #188 by adding optimistic locking support to the Firestore sample application.

Changes

  • Added the @Version annotation to the User entity in the Firestore sample app.
  • Implemented getter and setter methods for the version field.
  • Updated equals(), hashCode(), and toString() methods in the User class to include the version field for consistency.
  • (Optional) Included minor adjustments to Datastore mapping properties to ensure project-wide consistency.

Motivation

Optimistic locking is a critical feature for handling concurrent updates in Firestore. By adding this to the sample app, we provide a clear example for users on how to prevent data overwrites using Spring Data Cloud Firestore.

Testing

  • Verified that the project compiles successfully using ./mvnw clean compile.
  • Confirmed that the User entity correctly maps the version field.

Fixes #188

See
also CONTRIBUTING.md
.

@mehdi0933 mehdi0933 requested a review from a team as a code owner January 8, 2026 13:46
@mehdi0933 mehdi0933 force-pushed the feature/firestore-optimistic-locking-#188 branch from 019b79c to c8c1fb1 Compare January 8, 2026 13:54
@mehdi0933 mehdi0933 force-pushed the feature/firestore-optimistic-locking-#188 branch from c8c1fb1 to 69091fd Compare January 8, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add optimistic locking to Firestore sample app

1 participant