private StudentEntity lookupStudent(String matricNum) {
        StudentEntity s = new StudentEntity();
        try {
            Query q = em.createQuery("SELECT s FROM Student s WHERE s.matricNumber LIKE :matricNum");
            q.setParameter("matricNum", matricNum);
            s = (StudentEntity) q.getSingleResult();
        } catch (NoResultException e) {
            System.out.println("ERROR: Student does not exist. " + e.getMessage());
            s = null;
        }
        return s;
    }