private List<HashMap<String, Object>> getQuestionAnswerData(ExamResult examResult) {
    DetachedCriteria criteria =
        DetachedCriteria.forClass(ExamResultAnswer.class, "examResultAnswer");
    criteria.createAlias("examResultAnswer.question", "question");
    criteria.createAlias("examResultAnswer.answer1", "answer1");
    criteria.createAlias("examResultAnswer.answer2", "answer2");
    criteria.createAlias("examResultAnswer.answer3", "answer3");
    criteria.createAlias("examResultAnswer.answer4", "answer4");

    ProjectionList projectionList = Projections.projectionList();
    projectionList.add(Projections.property("question.questionId"), "questionId");
    projectionList.add(Projections.property("question.questionText"), "questionText");
    projectionList.add(Projections.property("answer1.answerId"), "answer1Id");
    projectionList.add(Projections.property("answer1.answerText"), "answer1Text");
    projectionList.add(Projections.property("answer2.answerId"), "answer2Id");
    projectionList.add(Projections.property("answer2.answerText"), "answer2Text");
    projectionList.add(Projections.property("answer3.answerId"), "answer3Id");
    projectionList.add(Projections.property("answer3.answerText"), "answer3Text");
    projectionList.add(Projections.property("answer4.answerId"), "answer4Id");
    projectionList.add(Projections.property("answer4.answerText"), "answer4Text");
    projectionList.add(
        Projections.property("examResultAnswer.examResultAnswerId"), "examResultAnswerId");
    projectionList.add(Projections.property("examResultAnswer.answerId"), "answerId");
    criteria.setProjection(projectionList);
    criteria.add(Restrictions.eq("examResultAnswer.examResultId", examResult.getExamResultId()));
    criteria.addOrder(Order.asc("examResultAnswer.ordinal"));
    criteria.setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP);

    return basicFinderService.findByCriteria(criteria);
  }
  private ExamResult getExamResult(Long examResultId) {
    DetachedCriteria criteria = DetachedCriteria.forClass(ExamResult.class, "examResult");
    criteria.add(Restrictions.eq("examResult.examResultId", examResultId));
    ExamResult examResult = basicFinderService.findUniqueByCriteria(criteria);
    if (!examResult.getUsername().equals(SecurityUtils.getUsername())) {

      throw new CoreException(CoreExceptionMessage.PERMISSION_DENIED);
    }
    if (examResult.getExamCompleted()) {
      throw new CoreException(CoreExceptionMessage.CANT_EDIT_EXAM);
    }
    return examResult;
  }