Index column on inverse List should throw a warning
Description
Activity
Steve EbersoleMarch 21, 2011 at 7:09 PM
Bulk closing stale resolved issues

Former userJanuary 12, 2011 at 12:45 AM
Frank, thanks for pointing out the documentation for OrderColumn in JPA 2.0.
After reviewing this again, I agree that that @OneToMany (mappedBy="...") should be supported.

Frank SchwarzJanuary 11, 2011 at 8:30 AM
Have you been looking for this phrase?:
JSR-317, p. 42: "Such schema-level mapping annotations must be specified on the owning side of the relationship."
"Such" in this context is only referring to "JoinColumn"/"JoinTable". "OrderColumn" is definitely not meant here.
Further one can read:
JSR 317, p.406: "The OrderColumn annotation is specified on the side of the relationship that references the collection that is to be ordered."
No restriction is stated here regarding uni-/bidirectionality of the relationship.
In consequence, the OP is wrong in demanding that a warning should be issued. This mapping has to be supported in the course of full JPA 2.0 support.

Former userJanuary 10, 2011 at 11:30 PM
The many-to-one side is the owner of a many-to-one/one-to-many association.
From JSR-317:
2.9 Entity Relationships:
"The many side of one-to-many / many-to-one bidirectional relationships must be the owning
side, hence the mappedBy element cannot be specified on the ManyToOne annotation."
11.1.36 OneToMany Annotation:
In table 33, the description for MappedBy is:
"The field or property that owns the relation-
ship. Required unless the relationship is uni-
directional."

Frank SchwarzJanuary 4, 2011 at 12:22 PM
The stated mapping is required to be supported by JSR 317 (JPA 2.0).
Details
Assignee
Former userFormer user(Deactivated)Reporter
Chris BredesenChris BredesenComponents
Priority
Major
Details
Details
Assignee

Reporter

The manual correctly warns against trying to map an indexed inverse collection on a List. However, a configuration containing this invalid mapping builds successfully but causes null values to be inserted for the index column.
Hibernate should be helpful and, if possible, throw a warning to the user (perhaps an error?) that explains the invalid combination. Here is an example that would run but produce invalid results:
The above is a typical one to many with the addition of @OrderColumn. Because Child owns the relationship, the index column is lost/ignored. Hibernate should warn about this.