This is based on this section:
In controller method, it creates a relation ship between RTRN_TP and RTRN_RSN
1. RTRN_RSN object set to HashSet
2. RTRN_TP object is saved
RTRN_RSN of “006”, “010”, and “011” have been bound to RTRN_TP of “01”
@RequestMapping(value = "/cUrlValAttrbSubTpRsn01Jsp", params = "toUnBoundRsnList", method = RequestMethod.POST) public ModelAndView toUnBoundRsnList(@ModelAttribute("RtrnTpModel") RtrnTpModel tp, ModelMap model, HttpServletRequest req) { String tpSelected = (String) req.getSession().getAttribute(CONST.TP_SELECTED.getVal()); if (CommonBL.hasValue(tpSelected)) { List<String> selectedCheckBox = tp.getSelectedCheckBox(); if (!CommonBL.isEmpty(selectedCheckBox)) { for (String code : selectedCheckBox) { RTRN_TP_RSN_CMBN tpRsnObj = this.tpRsnSvc.getTpRsnCmbnByHql(tpSelected, code); if (tpRsnObj != null) { this.tpRsnSvc.delete(tpRsnObj); } } } } return getMVSubTpRsn01(model, req); }
Unlike adding the relationship, to delete (un-bound) the relationship, it’s directly deleting the Join Table (RTRN_TP_RSN_CMBN)