code: public static long getMaxId(PersistenceBroker brokerForClass, Class topLevel, FieldDescriptor original) throws PersistenceBrokerException
      {
          long max = 0;
          long tmp;
          ClassDescriptor cld = brokerForClass.getClassDescriptor(topLevel);
  
          // if class is not an interface / not abstract we have to search its directly mapped table
          if (!cld.isInterface() && !cld.isAbstract())
          {
              tmp = getMaxIdForClass(brokerForClass, cld, original);
              if (tmp > max)
              {
                  max = tmp;
              }
          }
          // if class is an extent we have to search through its subclasses
          if (cld.isExtent())
          {
              Vector extentClasses = cld.getExtentClasses();
              for (int i = 0; i < extentClasses.size(); i++)
              {
                  Class extentClass = (Class) extentClasses.get(i);
                  if (cld.getClassOfObject().equals(extentClass))
                  {
                      throw new PersistenceBrokerException("Circular extent in " + extentClass +
                              ", please check the repository");
                  }
                  else
                  {
                      // fix by Mark Rowell
                      // Call recursive
                      tmp = getMaxId(brokerForClass, extentClass, original);
                  }
                  if (tmp > max)
                  {
                      max = tmp;
                  }
              }
          }
          return max;
      }
docs: Search down all extent classes and return max of all found
  PK values.