This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
When generating Entities from New->Persistence->Entity Class, netbeans generates equals using instanceof, but when you generate code later, netbeans generates equals using getClass() != obj.getClass() Second case returns false, if one of objects is proxy (it happens very often when using JPA lazy loading), so equals returns false all the time, and code fails. This error can appear, when you try to optimize application by annotating some entities as lazy loaded. Application errors start occurring, in unexpected places. Right now we have to rewrite equals code in all our entities. Also checking for equals implemented using getClass, when object is annotated with @Entity, could be added as error for code inspector (or hint to source code)
getClass() vs. instanceof: bug #156994 is mostly about that. *** This bug has been marked as a duplicate of bug 156994 ***