@Override
    public boolean updateStudentEmail(String matricNum, String newEmail) {
        Query q = em.createQuery("SELECT s FROM Student s WHERE s.matricNumber = :matric");
        q.setParameter("matric", matricNum);
        studentEntity = (StudentEntity) q.getResultList().get(0);
        if (newEmail.isEmpty()) {
            System.out.println("Error: Email to be updated cannot be empty!");
            return false;
        }
        studentEntity.setEmail(newEmail);
        em.merge(studentEntity);
        return true;
    }