Re: transactions - equals and hashcode method

Sunil Goyal <[email protected]>
Newsgroups gmane.comp.java.ozone.user
Organization Salzburg Research
Message-ID <[email protected]>
Hello all,

It looks the bug I was trying to find is because of the equals method.

I am using something like this..

class AImpl extends OzoneObject impelements A{
    String OID;  //

    public boolean equals(Object obj) {
         if (obj != null) {
         	if (OID.equals(((A)obj).getOID()) )
             	return true;
		}
         return false;
     }

     public int hashCode() {
		return OID.hashCode();
     }
}

Looks like this is giving me troubles and resulted in stack
overflow troubles later.

Is there some problem using the above approach for equals() and
hashcode() methods?

Thanks in advance.

Regards
Sunil


-- 
=====================================================================
Sunil Goyal
New Media Lab
Salzburg Research Forschungsgesellschft m.b.H.
Jakob Haringer-Strasse 5/III | A-5020 Salzburg
T: +43.662.2288-414 | F: +43.662.2288-222
[email protected]
http://www.salzburgresearch.at
======================================================================


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.