开发者

How to add an index to the DB column 'class' used for inheritance in Grails?

开发者 https://www.devze.com 2022-12-21 00:14 出处:网络
When using table-per-hierarchy inheritance, GORM creates a \'class\' column that stores the classname of instances.

When using table-per-hierarchy inheritance, GORM creates a 'class' column that stores the classname of instances.

I want to add DB index to this column, since many of my SQL queries include where class='com.myapp.Mychildclass'开发者_如何学Go . However, I didn't succeed with this code:

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

I tried different versions of this code without having the index created.

How can I do that?


I have found the answer of this question here: http://grails.1312388.n4.nabble.com/GORM-Howto-index-the-inheritance-class-column-td1563116.html

UPDATE : link updated

0

精彩评论

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