3.4.6.2.3. Bidirectional association with indexed collections
A bidirectional association where one end is an indexed collection (ie. represented as a
@IndexColumn, @org.hibernate.annotations.MapKey or @org.hibernate.annotations.MapKeyManyToMany) requires special consideration. If a property on the associated class explicitly maps the indexed value, the use of mappedBy is permitted:
But, if there is no such property on the child class, we can't think of the association as truly bidirectional (there is information available at one end of the association that is not available at the other end: the index). In this case, we can't map the collection as
mappedBy. Instead, we could use the following mapping:
Note that in this mapping, the collection-valued end of the association is responsible for updating the foreign key.