I have to do a deep copy of an entity. Basically there is a domain object whom I have to replicate so we need to do the deep copy of the entity and its child and child of child and soon. Than I need to set the id of everyone in the structure as null, so they get inserted as new entities. There is already some discussion here and link text. The basic idea is to write a deep copy logic on our own. I am just wondering if there are other better approaches like doing some procedures at the database level itself.
I am using hibernate as JPA provider, so hibernate specific solutions will also work.