tags:

views:

16

answers:

1

Hi,

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' . 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?

A: 

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

fabien7474