@Override
 public void insert(Person p) throws MapperException {
   Long buddyId = p.getBuddy() == null ? null : p.getBuddy().getId();
   try {
     PersonTDG.insert(p.getId(), p.getVersion(), p.getName(), p.getAge(), buddyId);
   } catch (SQLException e) {
     throw new MapperException(e);
   }
 }
 @Override
 public void delete(Person p) throws MapperException {
   int count;
   try {
     count = PersonTDG.delete(p.getId(), p.getVersion());
   } catch (SQLException e) {
     throw new MapperException(e);
   }
   if (count == 0) {
     throw new LostUpdateException(
         "It appears that someone else may already have changed this person.");
   }
 }
 @Override
 public void update(Person p) throws MapperException {
   Long buddyId = p.getBuddy() == null ? null : p.getBuddy().getId();
   int count;
   try {
     count = PersonTDG.update(p.getId(), p.getVersion(), p.getName(), p.getAge(), buddyId);
   } catch (SQLException e) {
     throw new MapperException(e);
   }
   if (count == 0) {
     throw new LostUpdateException(
         "It appears that someone else may already have changed this person.");
   }
   p.setVersion(p.getVersion() + 1);
 }