I think that the EJB 1.1 spec says that you have to implement these methods
in your primary key class, but don't quote me on that one.  In any case,
this is what Weblogic is telling you.  Below is the code I quickly generated
by the IDE that I use.  It is for a table with a string and a date as the
primary key, but I'm sure you will get the idea:


import java.io.Serializable;

import java.sql.Timestamp;

public class LogEntryPK implements Serializable
{
        public String username;
        public Timestamp date_time;


        public int hashCode() {

                return (username.hashCode()+date_time.hashCode());

        }

        public boolean equals(Object that) {

                if (!(that instanceof LogEntryPK))
                        return false;

                LogEntryPK tmp = (LogEntryPK)that;
                return (this.username.equals(tmp.username)
                &&     this.date_time.equals(tmp.date_time));
        }
}


Just one other quick question - if custid is your primary key why do you
have findByPrimaryKey() and findByCustId() ??  Also if custid is your
primary key, findByCustId() should never return more than one bean so why
the Enumeration ??

Hope this helps !

Lee
_________________________________

Lee Turner
Systems Developer
Information Technology Leeds
_________________________________

Watt Gilchrist Ltd
Ring Road, West Park
Leeds, LS16 6RA
Tel: 0113 288 3200
Fax: 0113 275 1690
http://www.wattgilchrist.co.uk
_________________________________


> -----Original Message-----
> From: Vipul Garg [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, February 23, 2001 1:12 PM
> To:   [EMAIL PROTECTED]
> Subject:
>
> Hi,
> I am using weblogic5.1and oracle 8 database.
> I have written Container Managed Persistence Bean that is connected to
> table
> Orders which has three fields and a primary key custid for which I have
> made
> a Primary Key class.I have defined these three methods in Home interface.
>         public Order create(int custid, String itemcode, int quantity)
> throws RemoteException, CreateException;
>         public Order findByPrimaryKey(OrderPK pk) throws RemoteException,
> FinderException;
>         public java.util.Enumeration findByCustID(int custid) throws
> RemoteException, FinderException;
> The following error is coming while deploying it on weblogic.
>
> [9.2.9] In EJB Order, the primary key class must implement the method
> public
> int hashCode().
> [9.2.9] In EJB Order, the primary key class must implement the method
> boolean equals(Object other).
>
> Could you help me in overcoming this error.
> Thanx,
> vipul
>
> ==========================================================================
> =
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to