Hi,
I 've written a sample code for you to see.
****** START ******
package com.sselvar;
// Import Statements
import java.io.Serializable;
public class TestEntityPK implements Serializable
{
public long personalDetailsId;
public long employeeId;
public int hashCode()
{
StringBuffer sb = new StringBuffer();
sb.append(personalDetailsId);
sb.append(employeeId);
String str=sb.toString();
return str.hashCode();
}
public boolean equals()
{
return true;
}
public java.lang.String toString()
{
return null;
}
public TestEntityPK()
{
}
public TestEntityPK (long personalDetailsId,long employeeId)
{
this.personalDetailsId=personalDetailsId;
this.employeeId=employeeId;
}
public long getPersonalDetailsId()
{
return personalDetailsId;
}
public long getEmployeeId()
{
return employeeId;
}
public boolean equals(Object obj)
{
if( (((TestEntityPK)obj).personalDetailsId==personalDetailsId) &&
(((TestEntityPK)obj).employeeId==employeeId) )
{
return true;
}
return false;
}
}
******* END *******
Regards,
Suresh Selvaraj
Sun Certified
Java Programmer