Skip to content
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

Update optimisticLocking.adoc #1065

Open
wants to merge 1 commit into
base: 4.7.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ To enable optimistic locking for your entity add ann:data.annotation.Version[] a
- `java.lang.Short`
- Date-time type extending `java.time.Temporal`

If you´re using Kotlin, be sure to use the Nullable types:

- `Int?`
- `Long?`
- `Short?`

(Otherwise they will be translated to their primitive types on the JVM and an exception containing `Unsupported @Version type: ...` will be thrown)

The field is going to be incremented (for number types) or replaced (for date types) on an update operation.

Micronaut Data will generate `UPDATE`/`DELETE` SQL queries with a version match: `... WHERE rec.version = :currentVersion ...` and if the update/delete doesn't produce any result api:data.exceptions.OptimisticLockException[] will be thrown.
Expand Down