• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why one-to-one mapping tag is not used in one-to-one relationship while many-to-one is used ?

 
Prabhat Ranjan
Ranch Hand
Posts: 397
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why many-to-one tag is used in one-2-one mapping of hibernate mapping of objects to table.

http://www.skill-guru.com/blog/2010/02/16/one-to-one-mapping-in-hibernate-using-foreign-key-association/

Point to note here is the Many-to-one tag. We are associating the entities with one-to-one but we are using a many-to-one tag. When using many-to-one in one-to-one mapping, we ignore the ‘many’ part. We are not caring how many address are bound to a customer, but here we ensure that only one customer (to-one part) is bound to an address.

Can you please let me know more on the rationale not to use a one-to-one mapping over your preffered many-to-one ?
What is the inconvenience in that case of using a one-to-one mapping ?

 
Prabhat Ranjan
Ranch Hand
Posts: 397
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but in some toutrial it is also used one-to-one tag:

http://www.roseindia.net/hibernate/hibernaterelationships/one-to-one-using-xml-metadata.shtml
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic