The Hibernate documentation recommends implementing equals and hashCode using an objects business key rather than the database id. Kent Tong in his excellent book _Enjoying Web Development with Tapestry_ implements equals using all fields of his example object, including the field which contains the database id and fields which are not part of the business key, in order to deal with concurrency issues. The issue with using the database id as part of the equals method is that it prevents you from adding an unpersisted object to a set. The problem with using fields that are not part of the business key is that if the object points to a large graph, the compare can be deep and expensive in terms of processing time. The problem with not using the id field and non-business key fields is that you can’t compare a database instance with its cached copy to see if it has changed before committing changes. So what should you do here?
Thanks for your help, Rob -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.385 / Virus Database: 268.3.5/301 - Release Date: 4/4/2006