posted 13 years ago
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.