You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/asciidoc/reference/mapping.adoc
+8-3
Original file line number
Diff line number
Diff line change
@@ -174,6 +174,11 @@ Within the mapping framework it can be applied to constructor arguments.
174
174
This lets you use a Spring Expression Language statement to transform a key’s value retrieved in the database before it is used to construct a domain object.
175
175
In order to reference a column of a given row one has to use expressions like: `@Value("#root.myProperty")` where root refers to the root of the given `Row`.
176
176
* `@Column`: Applied at the field level to describe the name of the column as it is represented in the row, allowing the name to be different than the field name of the class.
177
+
* `@Version`: Applied at field level is used for optimistic locking and checked for modification on save operations.
178
+
The value is `null` (`zero` for primitive types) is considered as marker for entities to be new.
179
+
The initially stored value is `zero` (`one` for primitive types).
180
+
The version gets incremented automatically on every update.
181
+
See <<r2dbc.optimistic-locking>> for further reference.
177
182
178
183
The mapping metadata infrastructure is defined in the separate `spring-data-commons` project that is technology-agnostic.
179
184
Specific subclasses are used in the R2DBC support to support annotation based metadata.
@@ -194,9 +199,9 @@ This works only if the parameter name information is present in the Java `.class
194
199
----
195
200
class OrderItem {
196
201
197
-
private @Id String id;
198
-
private int quantity;
199
-
private double unitPrice;
202
+
private @Id final String id;
203
+
private final int quantity;
204
+
private final double unitPrice;
200
205
201
206
OrderItem(String id, int quantity, double unitPrice) {
0 commit comments