Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 @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;
 }