GORM mapping - View Create Statement

时间:2015-11-12 10:54:31

标签: hibernate grails gorm

I have an Domain Class that is mapped on a Database View like this:

static mapping = {
   table 'view_foo'
}

If I start the project and the view doesn't exist there will be a table named view_foo.

How can I let hibernate create the Database View?

I would like to set an SQL Statement that will be run to instead of the hibernate generated statement, is that possible?

1 个答案:

答案 0 :(得分:0)

查看Grails数据库迁移插件。这在Hibernate初始化之前运行。它甚至允许使用本机SQL查询。