|Custom Insert/Update/Delete (Virsioning) [message #1022829]
||Fri, 22 March 2013 15:51
| Roman Smushkevich
Registered: June 2012
In my small project I use EclipseLink as a persistence framework.
The data structure is designed to use joined strategy. Besides, the entity table supports a special kind of versioning, which according to versioning methodology are:
1. One table, that holds the version numbers;
2. One common table on top of the hierarchy, that holds the entity key and two additional fields, namly creation version and deletion version.
3. Entity tables, that hold the entity attributes.
Each entity table has its own version field.
In case of the entity instance creation, one row will be created in the top table with new entity key and current version as a creation version. All entity tables in hierarchy will get one new row with current version and actual entity attributes.
In case of update only tables, which hold update attributes, will get new rows with new version.
In case of deleting only the row in the top table will be updated. The field deletion version will be updated with the current version.
The mechanism (queries) for such versioning methodology has been alredy programmed. I'm producing the simple query with the complex "where clause" to load only the row with last version.
The question is, how to substitute the apropriate Insert/Update/Delete queries with those, which instead of default operations will call specialized operations . In my case I want to substitute all update calls with insert calls; delete call with update call and so on. Is there some special solution for such cases? I would like to intercept all update calls and substitute them with appropriated insert statements.
Powered by FUDForum
. Page generated in 0.02362 seconds