• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Values defaulted from the attribute?

 
Ranch Hand
Posts: 110
Google Web Toolkit Java Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm studying for the JPA certification and I read this sentence in the book that I'm reading: "Ownership is important for mapping because the physical annotations that define the mappings to the columns in the database (for example, @JoinColumn) are always defined on the owning side of the relationship. If they are not there, the values are defaulted from the perspective of the attribute on the owning side."

I could not get the meaning of the last part, someone have an idea about what it could be?
 
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ownership is determined by usage of the "mappedBy" attribute.

If you use the mappedBy, it means the other side of the relationship owns the relationship, and will define the foreign key or join table.

For example in a ManyToMany one side will own the relationship and the other will use mappedBy. The name of the join table will be defined by the owning side, i.e. its name will come first, i.e. if Employee owned the relationship to Project, the table would be "EMP_PROJ" not "PROJ_EMP".

Or for a OneToOne, the side without the mappedBy will define the foreign key, the other side will not have a foreign key.
 
Jayr Motta
Ranch Hand
Posts: 110
Google Web Toolkit Java Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
James,

I do understand what ownership of a relationship works, the doubt isn't about it and thus about "the values are defaulted from the perspective of the attribute on the owning side.", sorry if I was not clear from the get-go.

Thanks in advance!
 
reply
    Bookmark Topic Watch Topic
  • New Topic