Leave a Reply

74 Comments on "Spring Boot Quick Start 20 – Implementing Update and Delete"

Notify of
avatar

ankit malhotra
Guest
ankit malhotra
28 days 19 hours ago

while passing json data for PUT I used "id " instead of "id" and similar to other Topic propertiesand it wasn't updating……spent whole day and realized this mistake and felt so angry-_-

Piyush W
Guest
Piyush W
1 month 13 days ago

I used following instead of regular for loop in PUT, works fine
topics.stream().filter(t->t.getId().equals(id))
.map(t->topics.set(topics.indexOf(t), topic))
.collect(Collectors.toList());

Piyush W
Guest
Piyush W
1 month 14 days ago

I used following instead of regular for loop in PUT, works finetopics.stream().filter(t->t.getId().equals(id)) .map(t->topics.set(topics.indexOf(t), topic)) .collect(Collectors.toList());

Agata Niemczycka
Guest
Agata Niemczycka
1 month 25 days ago

Hi, one question here – When I try to update one of the topics using PUT method I receive a message "Method [updateTopic] was discovered in the .class file but cannot be resolved in the class object". Any ideas how to solve the problem? I've already reset the project and tried to compare if there aren't any misspellings

Agata Niemczycka
Guest
Agata Niemczycka
1 month 25 days ago

Hi, one question here – When I try to update one of the topics using PUT method I receive a message "Method [updateTopic] was discovered in the .class file but cannot be resolved in the class object". Any ideas how to solve the problem? I've already reset the project and tried to compare if there aren't any misspellings

shashgo
Guest
shashgo
2 months 3 days ago
I have a question about Rest websites, about how to deploy a rest website, so that a user can use it like an ordinary website. If I create a website with html, then all I do is to upload it to a host like hostgator or godaddy, so that it is available to rest of the internet, and that anyone anyone can log on to their browser and access it. But how do I do that with a rest website? Do web host normally support java and spring boot? Also , how would a user send different kinds of requests:… Read more »
shashgo
Guest
shashgo
2 months 4 days ago
I have a question about Rest websites, about how to deploy a rest website, so that a user can use it like an ordinary website. If I create a website with html, then all I do is to upload it to a host like hostgator or godaddy, so that it is available to rest of the internet, and that anyone anyone can log on to their browser and access it. But how do I do that with a rest website? Do web host normally support java and spring boot? Also , how would a user send different kinds of requests:… Read more »
Victim of the System
Guest
Victim of the System
2 months 19 days ago

Simpler version for updateTopic method public void updateTopic(String id, Topic topic) { for (Topic element : topics) { if (element.getId().equals(id)) { topics.set(topics.indexOf(element), topic); } }

Victim of the System
Guest
Victim of the System
2 months 20 days ago

Simpler version for updateTopic method public void updateTopic(String id, Topic topic) { for (Topic element : topics) { if (element.getId().equals(id)) { topics.set(topics.indexOf(element), topic); } }

Lê Thanh Liêm
Guest
Lê Thanh Liêm
3 months 3 days ago

The issue could be happened if the id and the id in the body is different. Instead of update it will replace.In my opinion,It could be implement without id in the update method: public void updateTopic(Topic topic) { for(int i = 0; i <= topics.size(); i++) { if(topics.get(i).getId().equals(topic.getId())) { topics.set(i, topic); return; } } } @RequestMapping(method=RequestMethod.PUT, value="/topics") public void updateTopic(@RequestBody Topic topic) { topicService.updateTopic(topic); }

1 2 3 4
wpDiscuz