When using spring boot jpa, I encountered a problem. After each save, I get a return value, and the id in it is generated only after saving to the database.
When I tried to retrieve it, I found that it was 0, and the id of the returned object was 0, indicating that the save()
method does not return the object after storage.
After searching, I found that I need to add the @GeneratedValue(strategy = GenerationType.IDENTITY)
annotation to the id field of the Entity to return the latest id.