Hi,
I have a SWING application using a long lived hibernate session for as long as the application is running. The application uses a single inprocess DB and is single threaded. I have to implement undo/redo for removing objects from hibernate. I make use of the CommandPattern for storing a reference to the removed object. The problem I'm facing is how to reinsert it in the DB keeping all references intact?
Problems:
- there are uninitialized collections in the removed object and it gets detached when removed.
- there are other objects which get removed along with the root object (cascade=ALL)
- cloning is not a solution because I can have a chain of RemoveCommand(s) removing objects which refer to each other.
Any advice is highly appreciated.
Best regards,
cdan.
|