DEV Community

Discussion on: Part I: The Backend Using Java With Spring

Collapse
 
donut87 profile image
Christian Baer

One other thing. The update method, is just another create. It is quite impossible to update ToDos, if there are only getters. Is that intended?

Collapse
 
milanwittpohl profile image
Milan Wittpohl

Im not entirely sure what you mean here, could you tell me what method you are exactly referring to? If we want to create or update todos, we can use Springs save methods in the service/repository. It will check if the entry already exists and then either update the entry or create a new one.

Collapse
 
donut87 profile image
Christian Baer

My fault. I overlooked, that there has to be the id in the request. I thought because the constructor holds no id and it is already part of the URL it wouldn't make sense to send it with the body.