title: JPA QueryException: The list of fields to insert into the table is empty
body: <p>I actually have a problem with JPA. He is complaining about one 
  of my Entities:</p>
  
  <pre><code>javax.persistence.RollbackException: Exception [EclipseLink-6023] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.QueryException
  Exception Description: The list of fields to insert into the table [DatabaseTable(TBL_SPJ_CAST_MOVIE)] is empty.  You must define at least one mapping for this table.
  </code></pre>
  
  <p>After some researching i found out that this Exception appears when 
  there are no columns defined in the Entity classe because ofcourse
  you cant insert Data into an empty Table.</p>
  
  <p>However i have actually two columns defined in my Entity. One for the id
  and one for a foreign key to a m:n table:</p>
  
  <pre><code>import java.io.Serializable;
  import java.util.List;
  
  import javax.persistence.CascadeType;
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.FetchType;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  import javax.persistence.JoinColumn;
  import javax.persistence.JoinTable;
  import javax.persistence.ManyToMany;
  import javax.persistence.Table;
  
  @Entity
  @Table(name="TBL_SPJ_CAST_MOVIE")
  public class CastMovie implements Serializable {
      private static final long serialVersionUID = 1L;
      @Id
      @GeneratedValue(strategy=GenerationType.IDENTITY)
      @Column(name="CAST_MOVIE_ID", unique=true)
      private int castID = 0;
      @ManyToMany(fetch=FetchType.LAZY, cascade={CascadeType.ALL})
      @JoinTable(name="TBL_SPJ_CAST_ROLE", joinColumns={@JoinColumn(name="CAST_MOVIE_ID")}, inverseJoinColumns={@JoinColumn(name="ROLE_ID")})
      private List&lt;Role&gt; roles = null;
  
      public CastMovie() {}
  
      public int getCastID() {
          return castID;
      }
      public void setCastID(int castID) {
          this.castID = castID;
      }
      public List&lt;Role&gt; getRoles() {
          return roles;
      }
      public void setRoles(List&lt;Role&gt; roles) {
          this.roles = roles;
      }
  }
  </code></pre>
  
  <p>So whats the point of this Error? All Data coming from a xml file so i cant
  put in more columns (if thats the problem).</p>
  
  <p>EDIT:</p>
  
  <p>Here is the structure of the four tables involved in this problem:</p>
  
  <p><img src="https://i.stack.imgur.com/s0qu5.jpg" alt="enter image description here"></p>
  
  <ul>
  <li>One Movie has one Cast -> Relationship One to One</li>
  <li>Many Casts have many Rols -> Relationship Many to Many </li>
  </ul>