Hi Steven, OJB identifies objects by special Identity objects. An Identity object holds the class name and all primary key values of an Object. So we don't rely on Java mechanisms, but on database side identity! So the equals() and hashcode() methods are not used for OJB internal purposes.
So IMO there should be no problems with your persistent classes. Thomas > -----Original Message----- > From: Ebersole, Steven [mailto:[EMAIL PROTECTED] > Sent: Monday, March 17, 2003 3:10 PM > To: OJB Users List (E-mail) > Subject: overriding hashCode(), equals(), etc > > > Has anyone experienced any "gotchas" while overriding the methods from > Object and use of those classes in OJB? > > Caching comes to mind as possibly problematic. Basically, my > classes that I > want OJB to persist perfom the following overrides: > > > public String toString() > { > return getClass().getName() + " [id=" + getId() + > "]@" + hashCode(); > } > public int hashCode() > { > if (getId() == null) > return super.hashCode(); > else > return getId().intValue(); > } > public boolean equals( Object obj ) > { > if (obj == null) > return false; > > if (!getClass().isAssignableFrom( obj.getClass() )) > return false; > > return (hashCode() == obj.hashCode()); > } > > Can anyone see any potential issues with this? > > Thanks in advance.... > > > Steve Ebersole > IT Integration Engineer > Vignette Corporation > Office: 512.741.4195 > Mobile: 512.297.5438 > > Visit http://www.vignette.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]