Hi,
I'd like to ask whether it's possible to 'clone' an object (or rather a graph of hibernated objects) and persist them as new ones, keeping all existing properties, and updating all associations to use the 'cloned' references to objects... I'd need that badly to add timestamp-like functionality (I've checked the hibernate timestamps briefly, but I'd need more than that).
Plain Old Example:
Code:
entity Person : id, name, city_id, timestamp
entity City: id, name
Sample data:
Code:
Person (1, "Foo", 1, 13897636)
Person (2, "Bar", 1, 13967190)
City (1, "New York", 97390713)
Data I'd need to get after the cloning (somehow):
Code:
Person (3, "Foo", 2, 13897636)
Person (4, "Bar", 2, 13967190)
City (2, "New York", 97390713)
..and then I'd update the 'timestamps' myself before persisting these objects..
Is there any way to achieve such functionality? If I need to take the hard, manual way, what would be the less painful way to updates all the associations as well beside cloning the objects?
thanks much,
dyn