Skip to content
Open
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
2 changes: 1 addition & 1 deletion docs/topics/jvm/jvm-spring-boot-using-crudrepository.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ First, you need to adjust the `Message` class for work with the `CrudRepository`
</def>
<def title="CrudRepository save() function">
<p><a href="https://docs.spring.io/spring-data/jdbc/docs/current/reference/html/#jdbc.entity-persistence">This function works</a> with an assumption that the new object doesn't have an id in the database. Hence, the id <b>should be null</b> for insertion.</p>
<p> If the id isn't <i>null</i>, <code>CrudRepository</code> assumes that the object already exists in the database and this is an <i>update</i> operation as opposed to an <i>insert</i> operation. After the insert operation, the <code>id</code> will be generated by the data store and assigned back to the <code>Message</code> instance. This is why the <code>id</code> property should be declared using the <code>var</code> keyword.</p>
<p> If the id isn't <i>null</i>, <code>CrudRepository</code> assumes that the object already exists in the database and this is an <i>update</i> operation as opposed to an <i>insert</i> operation. After the insert operation, the <code>id</code> will be generated by the data store and assigned back to the <code>Message</code> instance.</p>
<p></p>
</def>
</deflist>
Expand Down