Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unique=true in hibernate

 
Mathew Lee
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to know more about unique=true in hibernate. Where and how and why to use it. How to use it for many-many, one-many, many-one, one-one Any ideas, resources, links, sample code highly appreciated.


Getting more confused especially with one-one where for example many students can have same address in this scenario STUDENT_ADDRESS column under student table is set to unique in STUDENT.hbm.xml file.
http://www.vaannila.com/hibernate/hibernate-example/hibernate-mapping-one-to-one-1.html

similarly in one-many example where one student can have many phone numbers the phone id kept as unique within set collection of many-many tag.
http://www.vaannila.com/hibernate/hibernate-example/hibernate-mapping-one-to-many-1.html
please advise.thanks in advance.
 
Arun Kumarr
Ranch Hand
Posts: 661
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please check the use of "many to many" and "unique" Here.
Also the site you're using to learn Hibernate never explains in depth the details of "many to many" usages.
If I were you, I would start learning from the hibernate docs first.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic