public static void delete(IUser u) throws SQLException, LostUpdateException { int count = UserTDG.delete(u.getId(), u.getVersion()); if (count == 0) throw new LostUpdateException("Lost Update deleting user with id " + u.getId()); // // What's the process for deleting a User... do we need to delete players and games? // More on that when we discuss referential integrity. // }
public static void update(IUser u) throws SQLException, LostUpdateException { int count = UserTDG.update(u.getId(), u.getVersion(), u.getUsername(), u.getPassword()); if (count == 0) throw new LostUpdateException("Lost Update editing user with id " + u.getId()); u.setVersion(u.getVersion() + 1); }
public static void insert(IUser u) throws SQLException { UserTDG.insert(u.getId(), u.getVersion(), u.getUsername(), u.getPassword()); }