You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rave.apache.org by Ankur Goyal <as...@umail.iu.edu> on 2011/12/06 19:33:10 UTC

Question on the address property of Person class

Hi,

While I was going through the Person.java class file, I saw a property
named addresses (type: List<Address>) which shows a one-to-many
relationship with a join table person_address_jn.

the code snippet looks like this:
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL,
orphanRemoval = true)
    @JoinTable(name = "person_address_jn",
            joinColumns = @JoinColumn(name = "address_id",
referencedColumnName = "entity_id"),
            inverseJoinColumns = @JoinColumn(name="person_id",
referencedColumnName = "entity_id"))
    protected List<Address> addresses;

So, I was wondering if the @JoinColumn(name = "*address_id*",
referencedColumnName = "entity_id"), should have the name as
*"person_id"*as the person class is the owning entity of the
relationship and refers to
the person's entity id and similarly the inverseJoinColumns name should be *
"address_id"*?
*
*
Regards,
Ankur Goyal* *

RE: Question on the address property of Person class

Posted by "Franklin, Matthew B." <mf...@mitre.org>.
>-----Original Message-----
>From: Ankur Goyal [mailto:asgoyal@umail.iu.edu]
>Sent: Tuesday, December 06, 2011 1:33 PM
>To: rave
>Subject: Question on the address property of Person class
>
>Hi,
>
>While I was going through the Person.java class file, I saw a property
>named addresses (type: List<Address>) which shows a one-to-many
>relationship with a join table person_address_jn.
>
>the code snippet looks like this:
>@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL,
>orphanRemoval = true)
>    @JoinTable(name = "person_address_jn",
>            joinColumns = @JoinColumn(name = "address_id",
>referencedColumnName = "entity_id"),
>            inverseJoinColumns = @JoinColumn(name="person_id",
>referencedColumnName = "entity_id"))
>    protected List<Address> addresses;
>
>So, I was wondering if the @JoinColumn(name = "*address_id*",
>referencedColumnName = "entity_id"), should have the name as
>*"person_id"*as the person class is the owning entity of the
>relationship and refers to
>the person's entity id and similarly the inverseJoinColumns name should be *
>"address_id"*?

That’s a bug.  I will create a ticket for it.  Thanks for reporting it.

-Matt

>*
>*
>Regards,
>Ankur Goyal* *