MODE-1740 Change hashCode and equals methods to handle not-yet-set IDs

These changes correct the hashCode and equals methods on three Entity classes so that these methods work when the entity IDs (which are configured to be automatically set by JPA) have not yet been set.

https://issues.jboss.org/browse/MODE-1740