From: Juozas B. <ba...@ce...> - 2002-12-29 19:54:51
|
equals() and hashCode() can be implemented using this definition : for all persistent objects a, b : a.equals(a) === true a.equals(b) ==> b.equals(a) a.equals(b) ==> a.hashCode() = b.hashCode() a is persistent ==> a.getId() != null a.equals(b) <=> a.getId().equals(b.getId()) a is persistent ==> a.hashCode() = a.getId().hashCode() > > > > > This is more or less what commons-lang's reflectionToString > > does (which is what Gavin's patch will make the CodeGenerator do now) > > > > But what about your hashCode ? > > > > /max > > > > I'm looking for advice on how to implement an equals() and hashCode() > method in my base class. Any suggestions are appreciated. > > Thanks, > > Matt > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel |