Getting error while updating an image into database using Java Spring

89 Views Asked by At

I tried the code below. I'm using both image and text for update, but I'm getting an application error. Can't infer the SQL type to use for an instance of this error I'm getting.

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);
0

There are 0 best solutions below