I want to restrict the user from entering duplicate assignments into DB, actually in the bridge table.
I have 2 tables:
professors and
courses an a bridge table containing prof_id and course_id as FKs.
In a jsp file user assigns professors to courses: 1 prof. to 1 or many courses.
I have:
In my method I receive
and pname(professor's name) as parameters from the form in the JSP file
Knowing pname's id, the FK, I want to insert now
into DB but to make sure user didn't choose 1 or more courses that the professor is already assigned to.
then I
where pname is a String(professor name), titles is a String Array(titles[] containing the courses I have to assign)
I tried with Set, Collections but I managed to enter the current courses+ again the already assigned courses
I also read about OUTER JOINS because I thought it might help.
I would kindly ask a reasonable way to solve it because I am intermediate...
Thank you.