ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Don't Let Hibernate Steal Your Identity
Subject:   Thanks
Date:   2007-12-13 10:03:47
From:   haywardl
Response to: Thanks

My project involves a webapp and desktop app. The desktop app involves detached object. We do not want to use extended session. The approach we take is similar to yours. The entities still have their own primary keys. However, a "uuid" attribute is added to the superclass of all entities. The uuid field is persisted in the database as well. This field gets set at object creation time exactly the same as you describe in your article. The equals and hashCode are based on the "uuid" field.