Hi, Perhaps I should clarify. Overiding the toString method from the default is a good idea.
I looked at the example you pointed out from the EJBII book. It is needed as the code in the example uses toString to access the AccountId value. I would have personally coded an getAccountId method as there is no hard and fast rule in Java to what the format of the String that toString method should return. Also in the example there is no need to use a compound key as it just contains a String so a simple String primary key would have done. At the end of the day looking at the spec toString for compound keys is not required to be overidden from the base implementation but it is a good idea. David --- Vivek Singh <[EMAIL PROTECTED]> wrote: > > Thanks for the reply. > I cannot copy it from the document.........but if > you have access to the > MasteringEJBII book, then if you go to the page > 142(174) it says that: > "There is a required toString() method". > > Vivek > ----- Original Message ----- > From: "David Jones" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, May 06, 2002 10:09 PM > Subject: Re: Primary Key > > > > Hi, > > > > >From the EJB2.0 spec > > > > "The primary key type must be a legal Value Type > in > > RMI-IIOP. The class must provide suitable > > implementation of the hashCode() and equals(Object > > other) methods to simplify the management of the > > primary keys by the Container." > > > > "The primary key class must be public, and must > have a > > public constructor with no parameters. > > All fields in the primary key class must be > declared > > as public." > > > > No mention of toString(), > > David > > > > ===== David J. Jones, <[EMAIL PROTECTED]>, Virgin Mobile USA, 8th Floor, 22 Fourth Street, San Francisco, CA, 94103, Work: 415 932 5470. USA. Fax: 415 358 4999. __________________________________________________ Do You Yahoo!? Yahoo! Health - your guide to health and wellness http://health.yahoo.com =========================================================================== 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".
