このコンテンツは選択した言語では利用できません。
6.2.3. Indexed collections
All collection mappings, except those with set and bag semantics, need an index column in the collection table. An index column is a column that maps to an array index, or
List index, or Map key. The index of a Map may be of any basic type, mapped with <map-key>. It can be an entity reference mapped with <map-key-many-to-many>, or it can be a composite type mapped with <composite-map-key>. The index of an array or list is always of type integer and is mapped using the <list-index> element. The mapped column contains sequential integers that are numbered from zero by default.
<list-index
column="column_name"
base="0|1|..."/>
<list-index
column="column_name"
base="0|1|..."/>
| column_name (required): the name of the column holding the collection index values.
|
| base (optional - defaults to 0): the value of the index column that corresponds to the first element of the list or array.
|
| column (optional): the name of the column holding the collection index values.
|
| formula (optional): a SQL formula used to evaluate the key of the map.
|
| type (required): the type of the map keys.
|
<map-key-many-to-many
column="column_name"
formula="any SQL expression"
class="ClassName"
/>
<map-key-many-to-many
column="column_name"
formula="any SQL expression"
class="ClassName"
/>
| column (optional): the name of the foreign key column for the collection index values.
|
| formula (optional): a SQ formula used to evaluate the foreign key of the map key.
|
| class (required): the entity class used as the map key.
|
If your table does not have an index column, and you still wish to use
List as the property type, you can map the property as a Hibernate <bag>. A bag does not retain its order when it is persisted to the database, but it can be optionally sorted or ordered when it is retrieved from the database.

