Database versioning and branching
I have a requirement in an application I'm creating to be able to allow in
a database (with preference of using Hibernate/JPA) to be able to create
branches of the model in a given moment (similar to a Version Control
System such as Git or Hg).
The branch is not for the schema of the database but for the data itself.
Both branches of the database will continue to evolve and these branches
will never be merged.
This operation can occur as many times as the user wants and it is very
likely that only a few rows will be changed in the newly created branch.
There is a few obvious solutions for this requirement:
duplicate all entries in the database, by adding a column with the name of
the branch for each entity;
to replicate the database in another schema.
If the database is very big (and I actually expect to have a lot of data)
these solutions will lead to performance issues.
The optimum solution would be that only the data changed within the branch
is actually committed to the database.
One framework that already provides this is the CDO (from EMF), but due to
some other contraints, we cannot use it in this particular project.
I've look into the hibernate envers (http://www.jboss.org/envers) but
envers only give you linear history, you cannot branch old data revisions.
Does anyone know some framework to deal with this using Hibernate (or
another JPA implementation)? Or does anyone had a similar requirement?
 
No comments:
Post a Comment