public boolean equals(Object obj) {
   if (obj == null) {
     return (false);
   } else if (obj instanceof CFDbTestRelationByNarrowedIdxKey) {
     CFDbTestRelationByNarrowedIdxKey rhs = (CFDbTestRelationByNarrowedIdxKey) obj;
     if (getOptionalNarrowedTenantId() != null) {
       if (rhs.getOptionalNarrowedTenantId() != null) {
         if (!getOptionalNarrowedTenantId().equals(rhs.getOptionalNarrowedTenantId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalNarrowedTenantId() != null) {
         return (false);
       }
     }
     if (getOptionalNarrowedId() != null) {
       if (rhs.getOptionalNarrowedId() != null) {
         if (!getOptionalNarrowedId().equals(rhs.getOptionalNarrowedId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalNarrowedId() != null) {
         return (false);
       }
     }
     return (true);
   } else if (obj instanceof CFDbTestRelationBuff) {
     CFDbTestRelationBuff rhs = (CFDbTestRelationBuff) obj;
     if (getOptionalNarrowedTenantId() != null) {
       if (rhs.getOptionalNarrowedTenantId() != null) {
         if (!getOptionalNarrowedTenantId().equals(rhs.getOptionalNarrowedTenantId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalNarrowedTenantId() != null) {
         return (false);
       }
     }
     if (getOptionalNarrowedId() != null) {
       if (rhs.getOptionalNarrowedId() != null) {
         if (!getOptionalNarrowedId().equals(rhs.getOptionalNarrowedId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalNarrowedId() != null) {
         return (false);
       }
     }
     return (true);
   } else {
     return (false);
   }
 }
 public int compareTo(Object obj) {
   if (obj == null) {
     return (1);
   } else if (obj instanceof CFDbTestRelationByNarrowedIdxKey) {
     CFDbTestRelationByNarrowedIdxKey rhs = (CFDbTestRelationByNarrowedIdxKey) obj;
     if (getOptionalNarrowedTenantId() != null) {
       Long lhsNarrowedTenantId = getOptionalNarrowedTenantId();
       if (rhs.getOptionalNarrowedTenantId() != null) {
         Long rhsNarrowedTenantId = rhs.getOptionalNarrowedTenantId();
         int cmp = lhsNarrowedTenantId.compareTo(rhsNarrowedTenantId);
         if (cmp != 0) {
           return (cmp);
         }
       } else {
         return (1);
       }
     } else {
       if (rhs.getOptionalNarrowedTenantId() != null) {
         return (-1);
       }
     }
     if (getOptionalNarrowedId() != null) {
       Long lhsNarrowedId = getOptionalNarrowedId();
       if (rhs.getOptionalNarrowedId() != null) {
         Long rhsNarrowedId = rhs.getOptionalNarrowedId();
         int cmp = lhsNarrowedId.compareTo(rhsNarrowedId);
         if (cmp != 0) {
           return (cmp);
         }
       } else {
         return (1);
       }
     } else {
       if (rhs.getOptionalNarrowedId() != null) {
         return (-1);
       }
     }
     return (0);
   } else if (obj instanceof CFDbTestRelationBuff) {
     CFDbTestRelationBuff rhs = (CFDbTestRelationBuff) obj;
     if (getOptionalNarrowedTenantId() != null) {
       Long lhsNarrowedTenantId = getOptionalNarrowedTenantId();
       if (rhs.getOptionalNarrowedTenantId() != null) {
         Long rhsNarrowedTenantId = rhs.getOptionalNarrowedTenantId();
         int cmp = lhsNarrowedTenantId.compareTo(rhsNarrowedTenantId);
         if (cmp != 0) {
           return (cmp);
         }
       } else {
         return (1);
       }
     } else {
       if (rhs.getOptionalNarrowedTenantId() != null) {
         return (-1);
       }
     }
     if (getOptionalNarrowedId() != null) {
       Long lhsNarrowedId = getOptionalNarrowedId();
       if (rhs.getOptionalNarrowedId() != null) {
         Long rhsNarrowedId = rhs.getOptionalNarrowedId();
         int cmp = lhsNarrowedId.compareTo(rhsNarrowedId);
         if (cmp != 0) {
           return (cmp);
         }
       } else {
         return (1);
       }
     } else {
       if (rhs.getOptionalNarrowedId() != null) {
         return (-1);
       }
     }
     return (0);
   } else {
     throw CFLib.getDefaultExceptionFactory()
         .newUnsupportedClassException(getClass(), "compareTo", "obj", obj, null);
   }
 }