Reputation: 10609
I actually have a problem with JPA. He is complaining about one of my Entities:
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.
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.
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:
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<Role> roles = null;
public CastMovie() {}
public int getCastID() {
return castID;
}
public void setCastID(int castID) {
this.castID = castID;
}
public List<Role> getRoles() {
return roles;
}
public void setRoles(List<Role> roles) {
this.roles = roles;
}
}
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).
EDIT:
Here is the structure of the four tables involved in this problem:
Upvotes: 2
Views: 1182