1

当使用table-per-hierarchy继承时,GORM 创建一个 'class' 列来存储实例的类名。

我想向该列添加数据库索引,因为我的许多 SQL 查询都包括where class='com.myapp.Mychildclass'. 但是,我没有成功使用此代码:

static mapping = { 
    columns { 
        'class' column: 'class', index: 'class_idx' 
    } 
} 

我在没有创建索引的情况下尝试了此代码的不同版本。

我怎样才能做到这一点?

4

1 回答 1

-1

我在这里找到了这个问题的答案:http: //grails.1312388.n4.nabble.com/GORM-Howto-index-the-inheritance-class-column-td1563116.html

更新:链接已更新

于 2010-02-26T11:51:19.517 回答