Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to manage object revisions in Grails?

I need to implement a revision system for articles in my grails web app. After searching grails forum, stackoverflow, grails plugins and googling internet, I have ended up with 3 options:

Option 1 - Using the grails Envers plugin (see http://code.google.com/p/grails-envers-plugin/). Has anyone used it successfully? Or using Envers without the plugin (see here) but how can I make it work with GORM?

Option 2 - Using the Gvers plugin I have found out here: https://github.com/ziftytodd/gvers. I never heard anyone using it, so is there anybody who have ever used it successfully?

Option 3 - Built -in mechanism. Weceem has created a versioning system for any content of the Weceem CMS. I can draw my inspiration from the logic of the code and design of this great application but it seems like overkill and I don't really like using non-standard solutions.

So my question, what do you advise me to do ? Have you ever used any of these options ?

Thank you very much for your insights.

like image 254
fabien7474 Avatar asked Aug 25 '10 10:08

fabien7474


2 Answers

Since I didn't get any answers during the days following my question, we have started investigating all of the options and came to the following results/conclusions :

  1. Envers plugin : while Envers is a well-established way to handle object revisions and auditing with Hibernate (as pointed out by Vadeg), there is no such out-of-the-shelf solution for grails. Envers plugin is stricly useless and a dead-never-born project. Therefore, using Envers with GORM is still not possible directly BUT I believe that there is a space for an Envers Plugin (maybe part of grail 2.0 ?) since Envers is now integral part of Hibernate core modules. However, we didn't have time to implement such a solution (which is by far the best one when you have enough time and resources ahead of you)...so we dropped it.

  2. Gvers plugin : Surprisingly this plug-in is working like a charm even if it seems that no one is using it in GRAILS world (even the plugin creator that has an invalid email!). Seems risky to go with it but if your requirements are low (like a basic versioning system), you should go with it..

  3. Built-In System : except if you are building a CMS system with very specific needs OR at the contrary something very simple, I would not go for it in any other cases. Weceem is very-well implemented with plenty of examples for CMS content revisions, but even for this, it's a pity that they don't use Envers instead. No need to reinvent the wheel...better to improve existing Ferrari, no?

  4. VCS System : one friend has suggested me to use existing solutions that are built especially for this kind of tasks : Version control System of course!! Actually GIT seems to be the perfect candidate : fast, reliable, alomst-free repositories available at your disposal. Actually this is perfect solution. My only problem : well, I don't know how to use Git (and even less its API) and again I don't have time.

Bottom Line

I will certainly use Gvers but if you are familiar with Git or if you feel comfortable with GORM and Hibernate, go for building a grail plugin (either based on Git or Envers)

like image 81
fabien7474 Avatar answered Nov 06 '22 08:11

fabien7474


I've used Envers in project with Hibernate and it works fine. GORM is based on the Hibernate, so I think there is no problem with it.

First of all, you need to decide what kind of versioning you need? Do you need to rollback object graph changes or you need to look after some fields? Sometimes it's better to make some small local implementation rather than injecting huge library.

If you need to revision graph of objects, Envers is a good choice. If you need to make revision of one field, DIY :)

like image 2
Vadeg Avatar answered Nov 06 '22 08:11

Vadeg