Re: Re: transactions - equals and hashcode method

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

> Are you sure you have no kind of recursion going on? 99 out of 100 stack
> overflows I get are recursion related.

I hope there's no recursion going on. I have checked for that.
I am sending in a sample code, which is giving me problem. It will be 
great
if some one can look into it.

Entity  and Emmo are the interfaces.
and EntityImpl and EmmoImpl are the equivalent classes.


and Test.java is the main class.

Thanks
Regards
Sunil


On 04 Mar 2004 16:29:35 +0100, Leo Mekenkamp <[email protected]> 
wrote:

> On Thu, 2004-03-04 at 16:07, Sunil Goyal wrote:
>> 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?
>
> No.
>
> Cheers,
> Leo
>
>



-- 
=====================================================================
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
======================================================================
Emmo.java (application/octet-stream, 208 B) - not displayed
Entity.java (application/octet-stream, 293 B) - not displayed
EmmoImpl.java (application/octet-stream, 671 B) - not displayed
EntityImpl.java (application/octet-stream, 1.4 KB) - not displayed
Test.java (application/octet-stream, 1.5 KB) - not displayed
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.