Fix Bug [ 1769579 ] PO.equals comparison wrong for new records

This commit is contained in:
Carlos Ruiz 2007-08-07 18:30:33 +00:00
parent 65f8e8a5e1
commit ef333ae53f
1 changed files with 5 additions and 1 deletions

View File

@ -231,7 +231,11 @@ public abstract class PO
if (!(cmp instanceof PO)) if (!(cmp instanceof PO))
return false; return false;
if (cmp.getClass().equals(this.getClass())) if (cmp.getClass().equals(this.getClass()))
return ((PO)cmp).get_ID() == get_ID(); // if both ID's are zero they can't be compared by ID
if (((PO)cmp).get_ID() == 0 && get_ID() == 0)
return super.equals(cmp);
else
return ((PO)cmp).get_ID() == get_ID();
return super.equals(cmp); return super.equals(cmp);
} // equals } // equals