开发者

Gorm vs. Hibernate Mapping in Grails?

开发者 https://www.devze.com 2023-04-07 03:18 出处:网络
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

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开发者_如何学C?


If you would like to use table-per-subclass that can be done by setting the mapping as follows:

static mapping = {
    tablePerHierarchy false
}

There is more documentation here.

I have used this option and it will work.

0

精彩评论

暂无评论...
验证码 换一张
取 消