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]

Reply via email to