@Override public void updateMarriage(Marriage m) { em.getTransaction().begin(); Marriage target = em.find(Marriage.class, m.getId()); target.setCountry(m.getCountry()); target.setEventDate(m.getEventDate()); target.setPerson(m.getPerson()); target.setState_province(m.getState_province()); target.setTown(m.getTown()); target.setSpouse(m.getSpouse()); em.merge(target); em.getTransaction().commit(); }
@Override public void addMarriage(Marriage marriageRecord) { Marriage m2 = new Marriage(); m2.setSpouse(marriageRecord.getPerson()); m2.setEventDate(marriageRecord.getEventDate()); m2.setCountry(marriageRecord.getCountry()); m2.setPerson(marriageRecord.getSpouse()); m2.setState_province(marriageRecord.getState_province()); m2.setTown(marriageRecord.getTown()); em.getTransaction().begin(); em.persist(marriageRecord); em.persist(m2); em.getTransaction().commit(); }