This content has been marked as final.
Show 1 reply
-
1. Re: Equals and hashCode on Entities fails due to javassist
jc7442 Aug 6, 2007 4:20 AM (in response to ejb3workshop)I suppose that in your equals you invoke getClass. I had the same problem. There is a Wiki on hibernate about equals and hashcode (http://www.hibernate.org/109.html).
For my entites, I never invoke getClass, I use a workaround to be sure not to have proxy. That's ugly, but I did not find something more elegant in javassist publi API.public static Class getBaseClass(Class srcClass) { if (srcClass.getName().contains(CGLIB) || srcClass.getName().contains(JAVASSIST)) { return srcClass.getSuperclass(); } return srcClass; }