/** * Updates the comment body. * * @param issue associated issue record * @param body Comment text * * @throws JiraException when the comment update fails */ public void update(String body) throws JiraException { update(body, null, null); }
//comment_id and childCommentData received from view Comment cm=Comment.findByCommentId(comment_id); //find comment from id ,findByCommentId() defined in Comment entity ChildComment childCom=new ChildComment(childCommentData,cm); //create new object of ChildComment ChildComment childComment=ChildComment.save(childCom); //persist the child comment object in db ,save() is a function in model which saves ChildComment object and return it List<ChildComments> allChildComments=cm.getChildComments(); //getting list of all the ChildComments . allChildComments.add(childComment); //add new comment to list cm.setChildComments(allChildComments); //set all the child comments in Comment Entity cm.update(comment_id); //update the Comments entity in db