public User setAdministrator(User obj) { PersistenceManager pm = PMF.get().getPersistenceManager(); User result = this.getComplete(obj.getId(), pm); if (result != null) { result.setAdministrator(obj.isAdministrator()); } pm.makePersistent(result); pm.close(); return result; }
@Override public User update(User obj) { PersistenceManager pm = PMF.get().getPersistenceManager(); User result = this.getComplete(obj.getId(), pm); if (result != null) { obj.setAdministrator(result.isAdministrator()); try { result.merge(obj); result.setDateLastUpdated(new Date()); } catch (Exception e) { e.printStackTrace(); } } pm.makePersistent(result); pm.close(); return result; }