11.1.43 OrderColumn Annotation says:
"The order column is not visible as part of the state of the entity or embeddable class."
Wow, that's new to me! Ok. But – since I'm an "old" hibernate user – what about about the following statements which still can be found in various hibernate docs:
We recommend you to convert the legacy @org.hibernate.annotations.IndexColumn usages to the JPA standard @javax.persistence.OrderColumn.
and 1. http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html_single/#collections-indexedbidirectional 2. https://docs.jboss.org/hibernate/orm/5.0/manual/en-US/html/ch07.html#collections-indexedbidirectional
7.3.3. Bidirectional associations with indexed collections
There are some additional considerations for bidirectional mappings with indexed collections (where one end is represented as a <list> or <map>) when using Hibernate mapping files. If there is a property of the child class that maps to the index column you can use inverse="true" on the collection mapping: [...] If there is no such property on the child class, the association cannot be considered truly bidirectional. That is, there is information available at one end of the association that is not available at the other end.
Same with annotations: 3. https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Web_Platform/5/html/Hibernate_Annotations_Reference_Guide/entity-hibspec-collection-extratype-indexbidir.html 4. http://docs.jboss.org/hibernate/stable/annotations/reference/en/html/entity.html#entity-hibspec-collection-extratype-indexbidir
3.4.6.2.3. / 2.4.6.2.1. Bidirectional association with indexed collections A bidirectional association where one end is an indexed collection (ie. represented as a @IndexColumn, [...]) 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).
Would be nice if you comment on this. Is it simply outdated or "wrong" if @OrderColum is used? |