[jboss-user] [JBoss Tools (users)] - equals() hashcode() generation feature request

damianharvey do-not-reply at jboss.com
Tue May 5 05:26:35 EDT 2009


Using the default Eclipse "Generate hashcode() and equals()" from the Source menu gives you these two methods but generated using fields rather than getters.

As Hibernate uses Proxy objects and only loads the actual object when a getter is encountered, these generated methods can prove problematic (eg. when comparing two identical entities for equality and if one is a proxy generated by CGLIB then they will not be equal as the proxied entity is not loaded via field access).

See here http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/ for an explanation. 

The Eclipse templates for this generation aren't accessible, so it would be handy if there was an option to create these methods with getters via the Hibernate Eclipse plugins that are part of the Jboss Tools.

Thanks,

Damian.

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

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



More information about the jboss-user mailing list