为Grails中的“has many”属性编制索引

为Grails中的“has many”属性编制索引,grails,indexing,gorm,has-many,Grails,Indexing,Gorm,Has Many,有可能在hasMany属性上建立索引吗 Class Author(){ static hasMany = [books: Book] static mapping = { books index:'book_id' } } 你可以这样用 Class Author(){ static hasMany = [books: Book] List books // Generates column `book_idx` in table for Book. stati

有可能在hasMany属性上建立索引吗

Class Author(){

 static hasMany = [books: Book]

  static mapping = {
    books index:'book_id'
  }

}
你可以这样用

Class Author(){

 static hasMany = [books: Book]
  List books // Generates column `book_idx` in table for Book.

static mapping = {
      books indexColumn: [name: "book", type: Integer]
    }
}