On a recent project we thought it would be a good idea to inherit a generic implementation of equals and hashCode, as well as the primariy key from an abstract entity. In the equals method we evaluate the class as well as the primary key. In most cases this worked really well for us, but in certain cases equality was not evaluated correctly. After looking further into the problem we found that in the cases it did not evaluate correctly the problem was caused by the classes not matching. It tried to compare one class (Test for example) against another (Test_$$_javassist_), which didn't equate and produces a false response.
I am guessing that the javassist originates from entities being loaded LAZY.
Is there a better way of achieving what we are trying to do ?
We are using JBoss 4.0.5 with EJB3 RC9.
Any suggestions welcome