aspose file tools*
The moose likes JPA Certification (OCEJPA) and the fly likes Values defaulted from the attribute? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » JPA Certification (OCEJPA)
Bookmark "Values defaulted from the attribute?" Watch "Values defaulted from the attribute?" New topic
Author

Values defaulted from the attribute?

Jayr Motta
Ranch Hand

Joined: Jul 30, 2010
Posts: 110

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?


Feel free to ask me anything!
www.BlackBeltFactory.com/ui#!/ref=jmotta, SCJP 6, OCWCD JEE5, OCE EJB JEE6
James Sutherland
Ranch Hand

Joined: Oct 01, 2007
Posts: 553
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.

TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
Jayr Motta
Ranch Hand

Joined: Jul 30, 2010
Posts: 110

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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Values defaulted from the attribute?