indexColumn
目的 Purpose
Customizes the index column definition of an indexed collection such as a List
or Map
使用例 Examples
class Neo { static hasMany = [matrix: Integer] static mapping = { matrix indexColumn: [name: "the_matrix", type: Integer] } }
def neo = new Neo() neo.matrix = [(1): 30, (2): 42, (3): 23] neo.save(flush: true)
詳細 Description
Usage:
使用方法: association_name(indexColumn:map)
Usage:
association_name(indexColumn:map)
引数: Arguments:
name
- The name of the column as a Stringtype
(optional) - The Hibernate type.sqlType
(optional) - The underlying SQL typeenumType
(optional) - The enum type in for type-safe Enum properties. Eitherordinal
orstring
.index
(optional) - The index nameunique
(optional) - Whether it is uniquelength
(optional) - The length of the columnprecision
(optional) - The precision of the columnscale
(optional) - The scale of the column
Map
or List
the index is stored in a column called association_name_idx
which is an integer
type in the case of lists and a String in the case of maps. You can alter how the index column is mapped using the indexColumn
argument:static mapping = { matrix indexColumn: [name: "the_matrix", type: Integer] }