This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes  unique=true in hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark " unique=true in hibernate" Watch " unique=true in hibernate" New topic

unique=true in hibernate

Mathew Lee
Ranch Hand

Joined: Jun 08, 2009
Posts: 238
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.

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.
please advise.thanks in advance.
Arun Kumarr
Ranch Hand

Joined: May 16, 2005
Posts: 661

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.

If you are not laughing at yourself, then you just didn't get the joke.
I agree. Here's the link:
subject: unique=true in hibernate
It's not a secret anymore!