Originally posted by Nischal Tanna:
Hi guys..
why is it necessary whether BMP or CMP, to override the equals() and hashCode() methods in the Primary Key class.?
I think the hashCode() should be overridden because the app server might be using the hash code of the primary key object to maintain the bean in a hash table, when it is cached in the server.
I remember one related issue in my last project, for some reason the value return by the primary keys hashCode() was not unique, this resulted in the finder method picking up the wrong bean, so we override the hashCode() method to return a the current time in millisecond ... this actually fixed the problem.