| we have legacy code where we have unique identifiers as artificial business keys in all our model classes. we do use this property in the #equals() and #hashCode() implementation of those model classes to determine equality/uniqueness of the instances.
 also we make sure upon instantiation of a model class, that this ID (business key) property is initialized right then, so that it is never null and always a valid, immutable value.
 
 now - with migrating to Hibernate, we wonder whether there are any hard reasons why it would be disadvantageous to re-use this unique business-key identifier as the primary key (aka @Id) for Hibernate ?
 - or would it be recommend (and why) to add an extra property as/for the artificial/surrogate primary key to each such model class?
 
 
 secondary: any good reason, apart from readability, speaking against an UUID as such PK ?
 
 thanks in advance - matthias
 
 
 |