There is probably referential integrity constraint (Foreign Key) from Student to StudentContact. So you can't remove StudentContact because student would point to nonexistent Entity.
You have to get rid of this reference first, something like:
tx = em.getTransaction();
tx.begin();
StudentContact contact = em.find(StudentContact.class,38);
Student student = contact.getStudent();
student.setContact(null);
contact.setStudent(null);
em.merge(student);
em.remove(em.merge(contact));
tx.commit();