Q1) You need to provide meaningful implementation for your hashcode and equals method if you are using custom primary class. This is required in order to obey the general contracts between
java objects. In this case each of your primary key instance is an object and it needs to obey the object contracts. To learn more about Java Object Contracts, take a look in to Chapter 3 of Effective Java Book; which explains all these in detail.
Moreover, most of the collection classes and algorithms related to Collection classes depend heavily on the equals. So if you havent provided meaningful implementation of these methods according to your scenario, you wont get meaningful results in your program. In most cases, even you will get very funny results too.
With regard to CMP
EJB's, I think most of the finder methods use collection classes to return the correct instance of the object. So it is very much required to implement the above said funtions.
Q1) If you are using a single primary key, you will be mostly dealing with generic data types like a
string or int or even dates. For all these generic data types java knows how to handle meaningfully the above functions. In other words the implementation for toString(), hashCode() equals() is already available with Java and that will hold good in all cases. This is the reason you dont need to have your own implementation for these cases.
Thanks
Shibu