Skip to content

Commit f0d7073

Browse files
committed
Moved section about state detection to include in commons.
This depends on spring-projects/spring-data-commons#2352
1 parent 6968c90 commit f0d7073

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

src/main/asciidoc/jdbc.adoc

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -430,24 +430,8 @@ Embedded entities containing a `Collection` or a `Map` will always be considered
430430
Such an entity will therefore never be `null` even when using @Embedded(onEmpty = USE_NULL).
431431

432432
[[jdbc.entity-persistence.state-detection-strategies]]
433-
=== Entity State Detection Strategies
434-
435-
The following table describes the strategies that Spring Data JDBC offers for detecting whether an entity is new:
436-
437-
.Options for detection whether an entity is new in Spring Data JDBC
438-
[options = "autowidth"]
439-
|===============
440-
|Id-Property inspection (the default)|By default, Spring Data JDBC inspects the version property of the given entity.
441-
If the identifier property is `null` or `0` in case of primitve types, then the entity is assumed to be new. Otherwise, it is assumed to not be new.
442-
|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.
443-
If the version property is present but has a different value, the entity is considered not new.
444-
If no version property is present Spring Data JDBC falls back to inspection of the Id-Property.
445-
|Implementing `Persistable`|If an entity implements `Persistable`, Spring Data JDBC delegates the new detection to the `isNew(…)` method of the entity.
446-
See the link:$$https://docs.spring.io/spring-data/data-commons/docs/current/api/index.html?org/springframework/data/domain/Persistable.html$$[Javadoc] for details.
447-
|Implementing `EntityInformation`|You can customize the `EntityInformation` abstraction used in the `SimpleJdbcRepository` implementation by creating a subclass of `JdbcRepositoryFactory` and overriding the `getEntityInformation(…)` method.
448-
You then have to register the custom implementation of `JdbcRepositoryFactory` as a Spring bean.
449-
Note that this should rarely be necessary. See the link:{javadoc-base}org/springframework/data/jdbc/repository/support/JdbcRepositoryFactory.html[Javadoc] for details.
450-
|===============
433+
include::{spring-data-commons-docs}/entity-callbacks.adoc[leveloffset=+1]
434+
451435

452436
[[jdbc.entity-persistence.id-generation]]
453437
=== ID Generation
@@ -892,7 +876,7 @@ The following table describes the available events:
892876

893877
WARNING: Lifecycle events depend on an `ApplicationEventMulticaster`, which in case of the `SimpleApplicationEventMulticaster` can be configured with a `TaskExecutor`, and therefore gives no guarantees when an Event is processed.
894878

895-
include::{spring-data-commons-docs}/entity-callbacks.adoc[leveloffset=+1]
879+
include::{spring-data-commons-docs}/is-new-state-detection.adoc[leveloffset=+2]
896880

897881
[[jdbc.entity-callbacks]]
898882
=== Store-specific EntityCallbacks

0 commit comments

Comments
 (0)