Dmitri, David, I leave it as today and add getPrimaryKey(), that is in fact exactly what I need, I could not find the way though. Its (ejb spec forced) equals/hashCode will do the trick for refering "the same row". I wanted to add such a method anyway to have an "entity aware" value object. Thanks! Vincent
> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]] On Behalf > Of David Jencks > Sent: lundi 18 f�vrier 2002 23:11 > To: [EMAIL PROTECTED] > Subject: Re: [Xdoclet-devel] About equals, hashCode in > Data/Value Objects > > > On 2002.02.18 16:49:19 -0500 Vincent Harcq wrote: > > Hi, > > 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. > > For the hashCode I would do the same as today but only of > pk attributes. > > What do you think ? > > > > Vincent > > > > I think it will be extremely confusing if equals and hashcode > don't reflect the entire object. Adding isIdentical (as > Dmitri suggests) or getPrimaryKey methods that can be used to > distinguish "the same row" objects in different states would > IMHO be much better. > > david jencks > > > > > > _______________________________________________ > > Xdoclet-devel mailing list [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/xdoclet-devel > > > > > > _______________________________________________ > Xdoclet-devel mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/xdoclet-devel > > _______________________________________________ Xdoclet-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-devel
