final int comparators[] = {
// First check parent category
CategoryUtils.compare(this.getParentCategory(), category.getParentCategory()),
- // ... last is i18n key as it is unique
- StringUtils.compare(this.getCategoryI18nKey(), category.getCategoryI18nKey())
+ // ... i18n key as it is unique
+ StringUtils.compare(this.getCategoryI18nKey(), category.getCategoryI18nKey()),
+ // ... primary key
+ Long.compare(this.getCategoryId(), category.getCategoryId())
};
// Check all values
int hash = 7;
hash = 13 * hash + Objects.hashCode(this.getCategoryI18nKey());
- hash = 13 * hash + Objects.hashCode(this.getCategoryId());
hash = 13 * hash + Objects.hashCode(this.getCategoryShownInStatistics());
hash = 13 * hash + Objects.hashCode(this.getParentCategory());
+ hash = 13 * hash + Objects.hashCode(this.getCategoryId());
return hash;
}
// Init comparators
final int comparators[] = {
- // First check product number
+ // First compare id numbers
+ Long.compare(this.getProductId(), product.getProductId()),
+ // ... next product number
SafeNumberUtils.compare(this.getProductNumber(), product.getProductNumber()),
// ... bar-code number
StringUtils.compare(this.getProductBarCodeNumber(), product.getProductBarCodeNumber()),