如何在 Grails 中管理对象修订?

发布于 2024-09-15 18:21:42 字数 997 浏览 11 评论 0原文

我需要为我的 grails Web 应用程序中的文章实现修订系统。在搜索 grails 论坛、stackoverflow、grails 插件和谷歌互联网后,我最终得到了 3 个选项:

选项 1 - 使用 grails Envers 插件(参见 http://code.google.com/p/grails-envers-plugin/)。有人使用成功过吗?或者使用 Envers 而不使用插件(请参阅 这里)但是我怎样才能让它工作与戈姆?

选项2 - 使用Gvers插件我在这里找到了:https://github.com/ziftytodd/gvers。我从来没有听说过有人用过它,所以有人成功地使用过它吗?

选项 3 - 内置机制Weceem 为 Weceem CMS 的任何内容创建了版本控制系统。我可以从这个伟大应用程序的代码逻辑和设计中汲取灵感,但这似乎有点矫枉过正,而且我真的不喜欢使用非标准解决方案。

所以我的问题是,你建议我做什么?您曾经使用过这些选项吗?

非常感谢您的见解。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

一萌ing 2024-09-22 18:21:42

由于在我提出问题后的几天里我没有得到任何答案,我们已经开始调查所有选项并得出以下结果/结论:

  1. Envers 插件:虽然 Envers 是一个很好的解决方案- 使用 Hibernate 处理对象修订和审计的既定方法(正如 Vadeg 所指出的),grails 没有这样现成的解决方案。 Envers 插件完全没用,是一个永远不会诞生的项目。因此,直接将 Envers 与 GORM 结合使用仍然是不可能的,但我相信 Envers 插件有空间(可能是 grail 2.0 的一部分?),因为 Envers 现在是 Hibernate 核心模块不可或缺的一部分。但是,我们没有时间实现这样的解决方案(当您有足够的时间和资源时,这是迄今为止最好的解决方案)...所以我们放弃了它。

  2. Gvers 插件:令人惊讶的是,即使在 GRAILS 世界中似乎没有人使用它(甚至是具有无效电子邮件的插件创建者!),这个插件也能像魅力一样工作。使用它似乎有风险,但如果您的要求很低(例如基本版本控制系统),您应该使用它

  3. 内置系统:除非您正在构建 CMS 系统具有非常具体的需求,或者相反,非常简单的需求,在任何其他情况下我都不会选择它。 Weceem 的实现非常好,有大量 CMS 内容修订的示例,但即使如此,遗憾的是他们没有使用 Envers。无需重新发明轮子...更好地改进现有的法拉利,不是吗?

  4. VCS 系统:一位朋友建议我使用专为此类任务构建的现有解决方案:当然是版本控制系统!实际上 GIT 似乎是完美的候选者:快速、可靠、几乎免费的存储库可供您使用。实际上这是完美的解决方案。我唯一的问题:嗯,我不知道如何使用 Git(更不知道它的 API),而且我也没有时间。

底线

我肯定会使用 Gvers,但如果您熟悉 Git 或者您对 GORMHibernate 感到满意>,去构建一个 grail 插件(基于 GitEnvers

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)

℡Ms空城旧梦 2024-09-22 18:21:42

我在 Hibernate 项目中使用了 Envers,效果很好。 GORM是基于Hibernate的,所以我认为它没有问题。

首先,您需要决定您需要哪种版本控制?您是否需要回滚对象图更改或者需要照顾某些字段?有时,最好进行一些小型的本地实现,而不是注入巨大的库。

如果您需要修改对象图,Envers 是一个不错的选择。
如果您需要修改某一字段,DIY :)

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 :)

诗酒趁年少 2024-09-22 18:21:42

Lucas Ward 的插件 有效。 Grails 1.3.7 已确认
重要的是确保实体更新在事务内,因为实体依赖于它。
只是提醒一下 Grails 控制器默认情况下不是事务性的。

Lucas Ward's plugin works. Confirmed with Grails 1.3.7
The important thing is to ensure entity updates are within transaction as envers depends on it.
Just to remind Grails controllers aren't transactional by default.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文