• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to save Many to Many values?  RSS feed

Tony Ghy
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've an Applicant class which has a many to many relationship with Category class.

My Objects are as follows:

Now I've a jsp from where I've a model attribute of Applicant class named "applicantAttribute" and "categoryList" is a List<Category> & I'm trying to save the form objects as shown below:

On submitting, my implementation logic is as follows:

It gives me the following error:

I tried to add CascadeType.ALL etc. which resulted in duplicate entries in Category table.

How can I add applicants_categories mapping which is many to many? What am i doing wrong?

Please guide!! I've wasted around 24 hours already trying to solve it. Any help will be really appreciated.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!