This week's book giveaway is in the Features new in Java 9 forum.
We're giving away four copies of Java 9 Revealed and have Kishori Sharan on-line!
See this thread for details.
Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Multiple columns UNIQUE constaint with relations  RSS feed

 
ruben depuben
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a link table that links Profiles to Tasks and stores some additional information belonging to the link. I am using a surrogate primary key in the link table.

ProfileTask
profiletask_id (pk)
profile_id (fk)
task_id (fk)
a_field (varchar)
b_field (varchar)
c_field (varchar)


In my mapping document I am enforcing a UNIQUE constraint on the profile_id and task_id combination, using <properties name="naturalKey" unique="true">. This works! All I really want to know is if this is the intended way to enforce the uniqueness of the natural key (profile_id, task_id), when using a surrogate primary key (profiletask_id).

Thanks.







 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!