@OneToMany making the many part ID unique (JPA)
<p>I'm trying to populate my database but I'm getting this error:</p>

<pre><code>&gt; recipe2: domain.Recipe2016-10-19 21:57:39,672 [main] WARN org.hibernate.engine.jdbc.spi.SqlExceptionHelper  - SQL Error: 1062, SQLState: 23000
2016-10-19 21:57:39,672 [main] WARN  org.hibernate.engine.jdbc.spi.SqlExceptionHelper  - SQL Error: 1062, SQLState: 23000
2016-10-19 21:57:39,672 [main] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper  - Duplicate entry '66' for key 'UK_hxsid8s70ok2lr0xu7438fdj7'
2016-10-19 21:57:39,672 [main] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper  - Duplicate entry '66' for key 'UK_hxsid8s70ok2lr0xu7438fdj7'
</code></pre>

<p>This is the code where I have the relationship between Recipe and Category:</p>

<pre><code>@NotEmpty
@Valid
@ElementCollection
@OneToMany
public Collection&lt;Category&gt; getCategories() {
    return categories;
}

public void setCategories(Collection&lt;Category&gt; categories) {
    this.categories = categories;
}
</code></pre>

<p>The thing is that I'm trying to have different recipes with the same category but it isn't allowing me to do that.
In the table created by hibernate in MySQL category_id is marked as Unique but I don't want any of the two parts to be Unique.</p>