Artem's blog

Thoughts on software


Some approach for writing equials() and hashCode()

The problem described in details in The problem is that if we implement equals()/hashCode() as comparison and hashCode() of entity’s ids (see then the hashCode() (and, possibly, equals()) will change after saving entities if ids are generated by DB. To solve this issue I can suggest to use inner classes with equals()/hashCode(). It […]

, , , , ,