java - Can't update object in a service with spring boot and mongodb -


currently, created spring controller rest , spring service.

i send string angular(promise) controller , controller calls function update of service.

here code of service :

@service public class linkserviceimpl implements linkservice{  @autowired private  userrepository userrepository;  @autowired private profilrepository profilrepository;    public linkserviceimpl() {  }   public void update( linkwidget linkentry) {     (profil profil : profilrepository.findall() ) {         profil updateprofil =  updateprofil(linkentry, profilrepository.findone(profil.getid()));         profilrepository.save(updateprofil);      }     }   public profil updateprofil(linkwidget linkentry,profil profil){          (theme theme : profil.getlistwidget()){               list<linkwidget> linkstoremove = new arraylist<linkwidget>() ;             (linkwidget link : theme.getlistlinkwidget()){                      try{                         if (link.getreflink() != null) {                         if (link.getreflink().equals(linkentry.getreflink())) {                              link.seturl(linkentry.geturl());                             link.setname(linkentry.getname());                             link.setimage(linkentry.getimage());                         }                         }                     }                     catch(nullpointerexception n){                      }               }            }          return profil;   }     } 

i profils in mongodb collection , after, parameter, search update objects same ref , profil @ end.

but update done time time . when profils after update, works sometines doesn't work. tried @transactional not philosophy of mongodb. question : why update doesn't work time? maybe problem code because there lot of tasks?


Comments