[jboss-user] [EJB 3.0] - Equals and hashCode on Entities fails due to javassist

ejb3workshop do-not-reply at jboss.com
Sun Aug 5 22:31:37 EDT 2007


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
Alex

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071016#4071016

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071016



More information about the jboss-user mailing list