rave-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ankur Goyal <asgo...@umail.iu.edu>
Subject Question on the address property of Person class
Date Tue, 06 Dec 2011 18:33:10 GMT
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* *

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message