Restore from history [message #873158] |
Thu, 17 May 2012 11:55  |
Eclipse User |
|
|
|
Hi,
We are using Eclipselink with the history customizer and the historical queries are working well. However, I was wondering whether a historical version can be restored easily.
I.e. if an entity is deleted and subsequently needs to be restored without loosing the work performed since the delete (so a database restore isn't acceptable) and not corrupting the history (the history shows it was deleted then restored).
I realise it is possible by reading from the history table and then persisting new objects with the relevant data. However, I doubt it is possible to get the primary keys to match (for the historical trace) if using the identity generator. You couldn't "merge" or "persist" with a set primary key as it would require IDENTITY_INSERT to be enabled. Additionally this would be a pain for an object with relationships to other objects which were also deleted at the same time (e.g. restoring a customer and all the related address, payment details, orders, etc).
I ask as in wiki.eclipse.org/EclipseLink_Exception_Error_Reference_(ELUG) the explanation for ECLIPSELINK-06103 it suggests a restore is possible but I am a bit confused as to what exactly is required.
Thanks,
Sam
|
|
|
Re: Restore from history [message #875893 is a reply to message #873158] |
Wed, 23 May 2012 10:02  |
Eclipse User |
|
|
|
As long as you don't use IDENTITY sequencing it should be possible just to re-persist the object. In general I would not recommend using IDENTITY sequencing, especially with history.
If you must use IDENTITY, then you need a way to re-insert the same primary key, perhaps with some database specific options.
[Updated on: Wed, 23 May 2012 10:02] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.04638 seconds