private StudentEntity findStudent(String matricNum) {
        StudentEntity s = new StudentEntity();
        try {
            Query q = em.createQuery("SELECT s FROM Student AS s WHERE s.matricNumber = :matricNum");
            q.setParameter("matricNum", matricNum);
            s = (StudentEntity) q.getSingleResult();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return s;
    }