Usual apologies if this has already been answered.
Tried rtfm but a lot of info. so slight possibility I may have missed something :-)
I'd like to migrate data between two databases.
I'm doing some initial testing on a staging machine and then re-deploying to another machine and I'd like the persisted data from the staging machine to be migrated to the deployment machine.
So, two databases with the same schema. Obviously can't just export and import the data as there will be conficts with sequences etc.
I've tried reading all the objects using one session factory then saving them using another but am getting a ConstraintViolationException with the message "Could not synchronize database state with session".
I had thought this was due to the hibernate identifiers being set so I've had a stab at reflectively setting them to null with very similar results.
The reflection code's getting a little ungainly and it occurs to me that hibernate does something very similar.
Is there any way to 'clear' detached objects?
Is there a better way to do this?
Cheers,
Jeremy.
|