Hi Tommy,
It worked.
I modified my PK class and it has worked. I was struggling with this problem
for long.
Thanks.
regards
Rajeev

-----Original Message-----
From: Tommy Eriksson [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 08, 2000 1:02 AM
To: Orion-Interest
Subject: Re: Problem with pkclass


I was experiencing the same kind of trouble just the other day. May fault
was in implementing the PK class I had forgot to implement the equals and
the hashCode methods, hope it helps.

Example of one of my PK classes:

package knut.ejb.entity;

public class UserContactPK implements java.io.Serializable {
    public String ownerId;
    public String contactId;

    public UserContactPK(String ownerId,String contactId)  {
        this.ownerId = ownerId;
        this.contactId = contactId;
    }

    public String getOwnerId()  {
        return ownerId;
    }
    public String getContactId()  {
        return contactId;
    }

    public String toString () {
     return ownerId+":"+contactId;
    }

    public boolean equals(Object other) {
        if (other instanceof UserContactPK) {
         return ownerId.equals(((UserContactPK)other).ownerId) &&
                   contactId.equals(((UserContactPK)other).contactId);
        }
        return false;
    }

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


----- Original Message -----
From: "Puthezhath, Rajeev (TWII Boston)" <[EMAIL PROTECTED]>
To: "Orion-Interest" <[EMAIL PROTECTED]>
Sent: Friday, December 08, 2000 1:36 AM
Subject: Problem with pkclass


> Hi
>
>  I have a specific problem regarding caching in orion. When I am passing
> only one varaible in Pk class all requests to the database for the same
> primary key before the bean gets passivated,is served from the instance in
> memory.But if i have more than one parameter is there in PK class then it
> calls ejbload for each request.(Bean is yet to be passivated).Can any body
> sugest any solution for this.
>
> Please reply.Incase i need to give more info please tell me
>
> Regards
>
> Rajeev


Reply via email to