Spring MVC not adding object to parent with Thymeleaf dynamic form -
so have dynamic form created thymeleaf , submits fine database, child object, in case row
, not being saved parent studyset
. when i'm in debug mode can see studyset contains arraylist of many row objects, when they're being saved, it's not being set studyset object.
i'll show code, see if i'm forgetting here. if can see problem , let me know great. in advance
here's post method in controller
@requestmapping(value="createstudyset", method=requestmethod.post) public string createsetpost (@modelattribute studyset studyset, modelmap model, @authenticationprincipal user user) { studyset.setuser(user); user.getstudyset().add(studyset); list<row> rows = studyset.getrows(); studyset.setrows(rows); studysetrepo.save(studyset); return "redirect:/answers"; }
also may helpful, screenshot of controller in debug mode, can see there rows in studyset.
so, want set rows studyset. realize code useless, shows attempt @ i'm trying do. list<row> rows = studyset.getrows(); studyset.setrows(rows);
.
also let me know if useful see domain objects, , add question.
Comments
Post a Comment