Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Restore from history(Restoring an entity to a historical version)
Restore from history [message #873158] Thu, 17 May 2012 15:55 Go to next message
Sam Ratcliff is currently offline Sam RatcliffFriend
Messages: 3
Registered: September 2011
Junior Member
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 14:02 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

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.


James : Wiki : Book : Blog : Twitter

[Updated on: Wed, 23 May 2012 14:02]

Report message to a moderator

Previous Topic:Problem with EclipseLink in Tomcat 7 (with RAP bridge)
Next Topic:Force index in MySQL 5.1
Goto Forum:
  


Current Time: Sat Nov 29 02:37:51 GMT 2014

Powered by FUDForum. Page generated in 0.01504 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software