Skip to main content

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

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 the explanation for ECLIPSELINK-06103 it suggests a restore is possible but I am a bit confused as to what exactly is required.

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 Sep 26 08:43:28 GMT 2020

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

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

Back to the top