public void changeStudent() {
   try {
     pmap.clear();
     sessions.clear();
     day = null;
     hour = null;
     if (command == 0) {
       childList.clear();
       selectedChild = -1;
       cdetail = null;
       searched = false;
     }
     sdetail = studentdao.findByID(selectedStudent);
     smap = savaildao.findByID(selectedStudent);
     skeys.clear();
     for (Map.Entry<String, List<String>> entry : smap.entrySet()) {
       skeys.add(entry.getKey());
     }
     // get the number of pairs for this student
     pairsCount = getPairsCount(selectedStudent);
     if (pairsCount > 0) {
       Student student = new Student();
       student.setStudentID(selectedStudent);
       for (Session pairing : padao.findByStudent(student)) sessions.add(pairing);
       for (Session pending : pedao.findByStudent(student)) sessions.add(pending);
     }
     // now populate days and hours in common if child is also selected
     if (selectedChild != -1) this.findDaysAndHours();
   } catch (SQLException ex) {
     Logger.getLogger(AdminPairing.class.getName()).log(Level.SEVERE, null, ex);
   }
 }
 private void findChildren() {
   childList.clear();
   try (Connection con = ds.getConnection()) {
     //            Student student = studentdao.findByID(selectedStudent);
     Map<String, List<String>> map = savaildao.findByID(selectedStudent);
     String sql = findChildrenSQL();
     try (PreparedStatement find = con.prepareStatement(sql)) {
       //                Map<String, List<String>> map = student.getDaymap();
       for (Map.Entry<String, List<String>> entry : map.entrySet()) {
         find.setString(1, entry.getKey());
         List<String> list = entry.getValue();
         // loop through the list
         for (int i = 0; i < list.size(); i++) {
           find.setString(2, list.get(i));
           try (ResultSet rs = find.executeQuery()) {
             while (rs.next()) {
               Child child = childdao.findByID(rs.getLong("childid"));
               // make sure it's not already a part of the list
               if (childList.isEmpty()) {
                 childList.add(child);
               } else
                 for (int j = 0; j < childList.size(); j++) {
                   if (childList.get(j).getChildID() == child.getChildID()) break;
                   if (j == childList.size() - 1) {
                     childList.add(child);
                     break;
                   }
                 }
             }
           }
         }
       }
     }
   } catch (SQLException ex) {
     Logger.getLogger(AdminPairing.class.getName()).log(Level.SEVERE, null, ex);
     System.err.println(ex.getMessage());
   }
 }