Re: How do I create my table to avoid java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '' for key 'PRIMARY'
Posted by: Karen Goh
Date: December 30, 2018 03:37AM

Well, I have removed PRIMARY KEY so that I can have rows with the same Id, depending on how many subjects a tutor can teach.

So, the error I have mentioned is gone.

But, my worry is that if I don't use PRIMARY Key, what if I remove the tutor_id, I need the correspondence subjects to be removed.

How should I construct my statement so that it will I can have the 'cascade delete' - as in I delete the tutor_id, anything in this join table will have that tutor_id removed also together with all rows of subjects that were inserted.

Options: ReplyQuote

Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.