Skip to content

Commit 3787976

Browse files
committed
Fix documenation of entity state-detection strategies.
Closes #2230
1 parent 7c339d8 commit 3787976

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/asciidoc/jpa.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ Spring Data JPA offers the following strategies to detect whether an entity is n
150150
2. Implementing `Persistable`: If an entity implements `Persistable`, Spring Data JPA delegates the new detection to the `isNew(…)` method of the entity. 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.
151151
3. Implementing `EntityInformation`: You can customize the `EntityInformation` abstraction used in the `SimpleJpaRepository` implementation by creating a subclass of `JpaRepositoryFactory` and overriding the `getEntityInformation(…)` method accordingly. You then have to register the custom implementation of `JpaRepositoryFactory` as a Spring bean. Note that this should be rarely necessary. See the link:$$https://docs.spring.io/spring-data/data-jpa/docs/current/api/index.html?org/springframework/data/jpa/repository/support/JpaRepositoryFactory.html$$[JavaDoc] for details.
152152

153-
Option 1 is not an option for entities that use manually assigned identifiers as with those the identifier will always be non-`null`.
153+
Option 1 is not an option for entities that use manually assigned identifiers and no version attribute as with those the identifier will always be non-`null`.
154154
A common pattern in that scenario is to use a common base class with a transient flag defaulting to indicate a new instance and using JPA lifecycle callbacks to flip that flag on persistence operations:
155155

156156
.A base class for entities with manually assigned identifiers

0 commit comments

Comments
 (0)