@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof ShoppingCategory)) { return false; } ShoppingCategory shoppingCategory = (ShoppingCategory) obj; long primaryKey = shoppingCategory.getPrimaryKey(); if (getPrimaryKey() == primaryKey) { return true; } else { return false; } }
public boolean equals(Object obj) { if (obj == null) { return false; } ShoppingCategory shoppingCategory = null; try { shoppingCategory = (ShoppingCategory) obj; } catch (ClassCastException cce) { return false; } long pk = shoppingCategory.getPrimaryKey(); if (getPrimaryKey() == pk) { return true; } else { return false; } }