Should @JoinTable be specified in both sides of a @ManyToMany relationship?
<p>I've an entity <code>Course</code> and an entity <code>User</code>. There's a <em>many-to-many</em> relation ship between course and user, since a course can have many users and a user can be enrolled in many courses. In both entities I've put the <code>@ManyToMany</code> annotation on the specific field, that is, in <code>Course</code> I have:</p>

<pre><code>@ManyToMany
private List&lt;RegisteredUser&gt; members;
</code></pre>

<p>and in <code>User</code> I have:</p>

<pre><code>@ManyToMany
private List&lt;Course&gt; coursesTaken;
</code></pre>

<p>Now, I know that this kind of many-to-many relationships are usually represented by a third table. I also know that there's the annotation <code>@JoinTable</code> which allows us to do that. What I don't know is if I should add this annotation <code>@JoinTable</code> over both fields in the two different entities or not. By the way, if I need to add to both, the names need to match right? </p>