@SuppressWarnings("unchecked") private void InitParentByParentCode(String code) throws QuestionBaseException { Session session = QuestionBaseFactory.GetInstance().getSessionFactory().openSession(); Query query = session.createQuery("select o from FamilyInfo o where familyCode = ?"); query.setString(0, code); List<FamilyInfo> parent = query.list(); for (FamilyInfo f : parent) { String sCode = f.getChildCode(); child = PersonUtil.getInstance().getPerson(sCode, session, null, null); this.sid = f.getSid(); this.name = f.getName(); break; } }
public Hashtable<Student, List<Question>> getChildApplyQuestions() { Session session = QuestionBaseFactory.GetInstance().getSessionFactory().openSession(); String c_Code = getChildCode(session); List<StudentQuestion> qCodes = getChildApplyQuestionCodes(session, c_Code); Hashtable<Student, List<Question>> result = new Hashtable<Student, List<Question>>(); for (StudentQuestion sq : qCodes) { if (result.containsKey(sq.getStudent())) { result.get(sq.getStudent()).addAll(sq.getQuestions()); } else { result.put(sq.getStudent(), sq.getQuestions()); ; } } return result; }