Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difference between JoinColumn and mappedBy

 
Amandeep Singh
Ranch Hand
Posts: 850
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Although i know that, if there is uni directional relationship between two table's we use like this-

Car.java
-------------------------
@OneToOne
@JoinColumn(name="CarBillingId", referencedColumnName="car_billing_id", updatable=false)
protected CarBillingInfo carBillingInfo;
-------------------------

but if there is bidirectional relationship we use like this-

CarBillingInfo.java

----------------------
@OneToOne(mappedBy="carBillingInfo")
protected Car car;
-----------------------

but when i see the Apache Derby Database, the result's alook same(both car and carbillinginfo table's have same relationship in both ways). So what is the real difference between them which i can see.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic