Grails 中的 Gorm 与 Hibernate 映射?
我知道 Gorm 在幕后使用 Hibernate 来实现它的目的。到目前为止,我还没有找到一种方法来使用 hibernate 映射策略进行继承 per-table-subclass 与 Gorm 一起使用,因此我不确定是否应该使用 Gorm。
我想要为我的网络应用程序中的大多数持久类提供一个基类,其中包含 创建日期、更新日期和名为“Deleted”的布尔值(因为这些将是类之间的公共字段)。我希望能够跟踪大多数类共有的字段,这是我的基类的目的。
我很久以前就参与过 Matt Rabile 的 Appfuse 项目,该项目为我生成了所有的休眠配置文件。
使用 hibernate 配置文件(对于这种情况和其他不可预见的未来情况)是否值得,或者我应该只使用 GORM,并忽略我的 OCD 租户,将常见的持久字段放入基类中?
I know that Gorm uses Hibernate under the covers to achieve what it does. As of yet I have not found a way to use the hibernate mapping strategy for inheritance with a per-table-subclass with Gorm and therefore I am not sure that I should use Gorm.
I want a base class for most of the persisted classes in my web-app that contains a Created Date, an Updated Date, and a boolean value called Deleted (as these will be common fields between the classes). I'd like to be able to keep track of the fields that are common to most of the classes which is the purpose of my base class.
I've worked with Matt Rabile's Appfuse project in the distant past which generated all of the hibernate config files for me.
Would it be worth it to use hibernate config files (for this and other unforseen future circumstances), or should I just use GORM, and ignore my OCD tenancies to put the common persisted fields in a base class?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想使用每个子类一个表,可以通过如下设置映射来完成:
有更多文档 此处。
我已经使用了这个选项并且它会起作用。
If you would like to use table-per-subclass that can be done by setting the mapping as follows:
There is more documentation here.
I have used this option and it will work.