[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5390) Index column on inverse List should throw a warning

Frank Schwarz (JIRA) noreply at atlassian.com
Tue Jan 11 01:31:05 EST 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5390?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=39557#action_39557 ] 

Frank Schwarz commented on HHH-5390:
------------------------------------

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.

> Index column on inverse List should throw a warning
> ---------------------------------------------------
>
>                 Key: HHH-5390
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5390
>             Project: Hibernate Core
>          Issue Type: Improvement
>          Components: annotations
>    Affects Versions: 3.5.3
>            Reporter: Chris Bredesen
>
> 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:
> {code}
> @Entity
> public class Parent {
>     @OneToMany(mappedBy="parent")
>     @OrderColumn(name="order")
>     private List<Child> children;
> }
> @Entity
> public class Child {
>     @ManyToOne
>     private Parent parent;
> }
> {code}
> 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. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list