@@ -185,6 +185,9 @@ The second operation will fail with a `OptimisticLockingFailureException` becaus
185
185
that does not exist anymore in the database.
186
186
In such cases the operation needs to get retried, beginning with a fresh fetch of the object with the current version from the database.
187
187
188
+ The `@Version` attribute is also mandatory if <<mapping.id-handling.business-key, business ids>> are used.
189
+ Spring Data Neo4j will check this field to determine if the entity is new or has already been persisted before.
190
+
188
191
[[mapping.annotations.property]]
189
192
=== Mapping properties: `@Property`
190
193
@@ -479,7 +482,11 @@ The name of the person is assigned at construction time, both by your applicatio
479
482
This is only possible, if you find a stable, unique business key, but makes great immutable domain objects.
480
483
481
484
* Advantages: Using a business or natural key as primary key is natural.
482
- The entity in question is clearly identified and it feels most of the time just right in the further modelling of your domain.
485
+ The entity in question is clearly identified, and it feels most of the time just right in the further modelling of your domain.
483
486
* Disadvantages: Business keys as primary keys will be hard to update once you realise that the key you found is not as stable as you thought.
484
487
Often it turns out that it can change, even when promised otherwise.
485
488
Apart from that, finding identifier that are truly unique for a thing is hard.
489
+
490
+ Please keep in mind that a business key is always set on the domain entity before Spring Data Neo4j processes it.
491
+ This means that it cannot determine if the entity was new or not (it always assumes that the entity is new),
492
+ unless also a <<mapping.annotations.version, `@Version` field>> is provided.
0 commit comments