[hibernate-issues] [Hibernate-JIRA] Issue Comment Edited: (HHH-5732) @OrderColumn not updated if @OneToMany has mappedby defined

Alexander Kunkel (JIRA) noreply at atlassian.com
Wed Mar 21 08:27:50 EDT 2012


    [ https://hibernate.onjira.com/browse/HHH-5732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46042#comment-46042 ] 

Alexander Kunkel edited comment on HHH-5732 at 3/21/12 7:27 AM:
----------------------------------------------------------------

I tried it with 4.1.0: Hibernate stores only 'null' into the index column. Same with the Hibernate annotation @IndexColumn.

Class S_List_Person:
{code}
@OneToMany(cascade = CascadeType.ALL, mappedBy="person")
@OrderColumn
public List<S_List_Telefon> getTelefonNummern() {
    if (telefonNummern == null) {
        telefonNummern = new ArrayList<S_List_Telefon>();
    }

    return telefonNummern;
}
{code}
Class S_List_Telefon:
{code}
@ManyToOne
@JoinColumn
public S_List_Person getPerson() {
    return person;
}
{code}

Table S_LIST_PERSON:
||ID||NAME||
|1|Goofy|
|2|Mickey|

Table S_LIST_TELEFON:
||NUMMER||BEMERKUNK||PERSON_ID||TELEFONNUMMERN_ORDER||
|0123451|mobile|1|null|
|07567|private|1|null|

      was (Author: minjaman):
    I tried it with 4.1.0: Hibernate stores only 'null' into the index column.

Class S_List_Person:
{code}
@OneToMany(cascade = CascadeType.ALL, mappedBy="person")
@OrderColumn
public List<S_List_Telefon> getTelefonNummern() {
    if (telefonNummern == null) {
        telefonNummern = new ArrayList<S_List_Telefon>();
    }

    return telefonNummern;
}
{code}
Class S_List_Telefon:
{code}
@ManyToOne
@JoinColumn
public S_List_Person getPerson() {
    return person;
}
{code}

Table S_LIST_PERSON:
||ID||NAME||
|1|Goofy|
|2|Mickey|

Table S_LIST_TELEFON:
||NUMMER||BEMERKUNK||PERSON_ID||TELEFONNUMMERN_ORDER||
|0123451|mobile|1|null|
|07567|private|1|null|
  
> @OrderColumn not updated if @OneToMany has mappedby defined
> -----------------------------------------------------------
>
>                 Key: HHH-5732
>                 URL: https://hibernate.onjira.com/browse/HHH-5732
>             Project: Hibernate ORM
>          Issue Type: Bug
>          Components: entity-manager
>    Affects Versions: 3.6.0
>            Reporter: Jaroslaw Lewandowski
>         Attachments: Screen shot 2011-01-10 at 21.41.27.png, TestOrderColumn.zip
>
>
> As I'm not able to reopen HHH-5378 I'm creating a new one. There is nothing said in JPA2.0 documentation that with @OrderColumn are any limitations regarding of usage mappedBy attribute on @OneToMany annotation. As I mentioned in the comments of that issue - even Hibernate documentation http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/collections.html#collections-indexed uses example which fails when executed with 3.6.0.Final version.
> Test case attached.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list