title: JPA (with Hibernate) @ManyToMany @JoinTable relationship cascade
body: <p>There's a way to map a relationship many-to-many, using the <code>@jointable</code>, and avoid the automatic cascade of jointable rows?</p>
  
  <p>The cascade property of the <code>@ManyToMany</code> annotation is for create/merge/delete the related entity (not the rows of jointable) and the insertable/updatable of joincolumns/ inversejoincolumns properties in <code>@JoinTable</code> is ignored when I persist/merge the owned entity of relationship.</p>
  
  <p>Example: In <code>User</code> (Owner) x <code>Role</code> (mappedby) relationship, when I merge an User with the collection of Role empty, all rows of table <code>USER_ROLE</code> is deleted for that user.</p>
  
  <p>Tks in advance.</p>
  
  <hr>
  
  <p>That's my point:</p>
  
  <p>For make the problem question simple, let's suppose that I have an User entity with three attributes: id, email and a set of Roles (owner, @manytomany, @jointable).
  I will merge an User entity that have at least one or more Roles, without find it through entityManager:</p>
  
  <pre><code>User user = new User(); //detached
  user.setId(1L); // for merge
  user.setEmail("newemailaddress@example.com");
  
  entityManager.merge(user);
  </code></pre>
  
  <p>The result in database is:</p>
  
  <pre><code>UPDATE user... /*ok!*/
  delete from user_role where ... /* I'd like to avoid it! */
  </code></pre>