I have a complex CompositeUserType that takes a given Java object and persists it into a “standard” column db type, but also optionally stores a couple of transformations of the value into different columns.
For example a string might be persisted into 1-3 different columns:
- Column for original varchar value
- Column for a hash/checksum of the value
- Column for another optional transformation
In this situation, what is the expected contract of hashCode/equals for my UserType?
Should I only do hashCode/equals on the original string? Or should I include the optional transformations in the hashCode/equals calculation as well, even though they are all derived from the original string value?