Browse Source

DATAMONGO-2348 - Update documentation of version property handling.

pull/787/head
Christoph Strobl 7 years ago
parent
commit
a3c5b07eb7
  1. 2
      src/main/asciidoc/reference/mapping.adoc

2
src/main/asciidoc/reference/mapping.adoc

@ -420,7 +420,7 @@ The MappingMongoConverter can use metadata to drive the mapping of objects to do @@ -420,7 +420,7 @@ The MappingMongoConverter can use metadata to drive the mapping of objects to do
* `@PersistenceConstructor`: Marks a given constructor - even a package protected one - to use when instantiating the object from the database. Constructor arguments are mapped by name to the key values in the retrieved Document.
* `@Value`: This annotation is part of the Spring Framework . Within the mapping framework it can be applied to constructor arguments. 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. In order to reference a property of a given document one has to use expressions like: `@Value("#root.myProperty")` where `root` refers to the root of the given document.
* `@Field`: Applied at the field level it allows to describe the name and type of the field as it will be represented in the MongoDB BSON document thus allowing the name and type to be different than the fieldname of the class as well as the property type.
* `@Version`: Applied at field level is used for optimistic locking and checked for modification on save operations. The initial value is `zero` which is bumped automatically on every update.
* `@Version`: Applied at field level is used for optimistic locking and checked for modification on save operations. The initial value is `zero` (`one` for primitive types) which is bumped automatically on every update.
The mapping metadata infrastructure is defined in a separate spring-data-commons project that is technology agnostic. Specific subclasses are using in the MongoDB support to support annotation based metadata. Other strategies are also possible to put in place if there is demand.

Loading…
Cancel
Save