public int compareTo(itemReservation other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    itemReservation typedOther = (itemReservation) other;

    lastComparison = Boolean.valueOf(isSetUid()).compareTo(typedOther.isSetUid());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUid()) {
      lastComparison = TBaseHelper.compareTo(uid, typedOther.uid);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetItemNumber()).compareTo(typedOther.isSetItemNumber());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetItemNumber()) {
      lastComparison = TBaseHelper.compareTo(itemNumber, typedOther.itemNumber);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison =
        Boolean.valueOf(isSetReserveQuantity()).compareTo(typedOther.isSetReserveQuantity());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetReserveQuantity()) {
      lastComparison = TBaseHelper.compareTo(reserveQuantity, typedOther.reserveQuantity);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetOrderNumber()).compareTo(typedOther.isSetOrderNumber());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOrderNumber()) {
      lastComparison = TBaseHelper.compareTo(orderNumber, typedOther.orderNumber);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetFromId()).compareTo(typedOther.isSetFromId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFromId()) {
      lastComparison = TBaseHelper.compareTo(fromId, typedOther.fromId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }