Change hbm2java equals(Object) implementation to be proxy safe

This changes the semantics of the equals(Object) method as we compare that classes are equal, rather than the existing instanceof method. I did this because I don't think the instanceof method was the right solution, I think it should have always been ensuring the two objects were the same class.

This equals method requires that any methods used to determine equality are implemented in the proxy interface.

If you're not using proxies then then only impact is the change to compare classes rather than use instanceof.