code: private void sortFields()
      {
          HashMap            fields          = new HashMap();
          ArrayList          fieldsWithId    = new ArrayList();
          ArrayList          fieldsWithoutId = new ArrayList();
          FieldDescriptorDef fieldDef;
  
          for (Iterator it = getFields(); it.hasNext(); )
          {
              fieldDef = (FieldDescriptorDef)it.next();
              fields.put(fieldDef.getName(), fieldDef);
              if (fieldDef.hasProperty(PropertyHelper.OJB_PROPERTY_ID))
              {
                  fieldsWithId.add(fieldDef.getName());
              }
              else
              {
                  fieldsWithoutId.add(fieldDef.getName());
              }
          }
  
          Collections.sort(fieldsWithId, new FieldWithIdComparator(fields));
  
          ArrayList result = new ArrayList();
  
          for (Iterator it = fieldsWithId.iterator(); it.hasNext();)
          {
              result.add(getField((String)it.next()));
          }
          for (Iterator it = fieldsWithoutId.iterator(); it.hasNext();)
          {
              result.add(getField((String)it.next()));
          }
  
          _fields = result;
      }
docs: Sorts the fields.