> Today equals() method of DataObjects returns true if all attributes > internal of the DO are equals. > I would prefer to see it true only if the attributes that are part of > the PK are equals. > If you put one instance of a DO refering an entity A in a List. Then > want later to get it from the list, I espect that the find will be done > on the PK attributes only. Supposing my DO changes in middle some > internal attributes I am still referring the same "entity". > I find this requirement more logical from the "user" of the DO. > If PK fields are null, equals would return false. > Now I understand also the need to compare all attributes. I think about > a isIdentical method that will return true if pk attributes are not null > and all other attributes are equals.
I'd prefer to add the isIdentical method over changing the behaviour of equals. Imagine the situation where a client calls getData, modifies the data, and sends it back calling setData. Really, we should be able to have the first line of setData do an equals() check against the loaded data object, or something like this. on the other side of the coin, suppose I want to put a bunch of data objects in a collection. in that case what you are saying is spot on - equals (and hashcode) should only look at the pk fields. > For the hashCode I would do the same as today but only of pk attributes. definately - hashCode and equals must follow the same list of significant fields. > What do you think ? I'd like to leave it as is, but I can see the arguments for change. the question in my mind is what would it give us that we dont have already? cheesr dim _______________________________________________ Xdoclet-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-devel
