• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Multiple columns UNIQUE constaint with relations

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.







 
Onion rings are vegetable donuts. Taste this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic