|
|
|
@ -7,14 +7,14 @@ The following table describes the strategies that Spring Data offers for detecti |
|
|
|
[options = "autowidth",cols="1,1"] |
|
|
|
[options = "autowidth",cols="1,1"] |
|
|
|
|=== |
|
|
|
|=== |
|
|
|
|`@Id`-Property inspection (the default) |
|
|
|
|`@Id`-Property inspection (the default) |
|
|
|
|By default, Spring Data inspects the version property of the given entity. |
|
|
|
|By default, Spring Data inspects the id property of the given entity. |
|
|
|
If the identifier property is `null` or `0` in case of primitive types, then the entity is assumed to be new. |
|
|
|
If the id property is `null` or `0` in case of primitive types, then the entity is assumed to be new. |
|
|
|
Otherwise, it is assumed to not be new. |
|
|
|
Otherwise, it is assumed to not be new. |
|
|
|
|
|
|
|
|
|
|
|
|`@Version`-Property inspection |
|
|
|
|`@Version`-Property inspection |
|
|
|
|If a property annotated with `@Version` is present and `null`, or in case of a version property of primitive type `0` the entity is considered new. |
|
|
|
|If a property annotated with `@Version` is present and `null`, or in case of a version property of primitive type `0` the entity is considered new. |
|
|
|
If the version property is present but has a different value, the entity is considered to not be new. |
|
|
|
If the version property is present but has a different value, the entity is considered to not be new. |
|
|
|
If no version property is present Spring Data falls back to inspection of the Id-Property. |
|
|
|
If no version property is present Spring Data falls back to inspection of the id property. |
|
|
|
|
|
|
|
|
|
|
|
|Implementing `Persistable` |
|
|
|
|Implementing `Persistable` |
|
|
|
|If an entity implements `Persistable`, Spring Data delegates the new detection to the `isNew(…)` method of the entity. |
|
|
|
|If an entity implements `Persistable`, Spring Data delegates the new detection to the `isNew(…)` method of the entity. |
|
|
|
|