我尝试了下面的代码。我正在使用图像和文本进行更新,但我收到了应用程序错误。无法推断出用于此错误的实例的SQL类型。
QuestionRef questionRef = ceBean.get("questionRef");
QuestionRef oldQuestionRef = this.getQuestionRef(ceBean);
questionRef.setAnswerId(oldQuestionRef.getAnswerId());
int i = 0;
MultipartFile[] answerImage = questionRef.getAnswerImage();
for (String answer : questionRef.getAnswerId()) {
QuestionAns questionAns = new QuestionAns();
if (answerImage[i].getSize() > 0) {
questionAns.setImage_answer(XUtil.encodeToBase64(answerImage[i].getBytes()));
ceBean.put("questionAns", questionAns);
questionRefDAO.updateAnswerImage(ceBean);
}
else if (StringUtils.isNotBlank(questionRef.getAnswer()[i])) {
ceBean.put("questionAns", questionAns);
questionRefDAO.updateAnswer(ceBean);
}
i++;
}
Long q_id = questionRef.getQuestion_id();
questionRef.setQuestion_id(q_id);
ceBean.put("questionRef", questionRef);
questionRefDAO.updateQuestionRef(ceBean);