Hi
All collection mappings, except those with set and bag semantics, need an index column in the collection table - 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 may be an entity reference mapped with <map-key-many-to-many>, or it may 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 (numbered from zero, by default).
extracts from 6.2.3. Indexed collections
So that means you don't nessasary to set list-index to a field in parent table. But you must mention a column which exist or which is in your query. In this section in the Person, Address example actually it doesn't work. trying to access list object (people) in address collection. it will give sqlgrammerexception. In this section in the Person, Address example it will return Addresslist . but error in accessing people List.
Amila
(Don't forget to rate if helps)
|