Skip to content

Fix typo in entity state detection documentation #2416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/asciidoc/is-new-state-detection.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ The following table describes the strategies that Spring Data offers for detecti
[options = "autowidth",cols="1,1"]
|===
|`@Id`-Property inspection (the default)
|By default, Spring Data inspects the version 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.
|By default, Spring Data inspects the id property of the given entity.
If the id property is `null` or `0` in case of primitive types, then the entity is assumed to be new.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason you're changing identifier into id in random places?

Copy link
Contributor Author

@schlagi123 schlagi123 Jul 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some places in the text there is Id, in other places there is an identifier. I thought I would unify it in this section. I don't care whether it's id or identifier, I just thought id is closer to @Id annotation than identifier.

Otherwise, it is assumed to not be new.

|`@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 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`
|If an entity implements `Persistable`, Spring Data delegates the new detection to the `isNew(…)` method of the entity.
Expand Down