How to add an index to the DB column 'class' used for inheritance in Grails?
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
精彩评论