I really have a problem with JPA he has been complaining about my entities:
javax.persistence.RollbackException: exception [EclipseLink-6023] (Eclipse persistence services - 2.3.2.v20111125-r10461): org.eclipse.persistence .exceptions.QueryException exception details: table [database table (TBL_SPJ_CAST_MOVIE)] The list of fields to be inserted is empty. You must define at least one mapping for this table. some research I found out this exception appears to be that when a column unit defined classe, because of course since you are entering data into an empty table can not .
Although I have really two columns in my existence, for an ID for one and one for a foreign key m: n table:
import java. Io.Serializable; Import java.util.list; Import javax.preistence.CascadeType; Import javax.preistence.Column; Import javax.preistence.Entity; Import javax.preistence.FetchType; Import javax.preistence.GeneratedValue; Import javax.preistence.GenerationType; Import javax.preistence.Id; Import javax.preistence.JoinColumn; Import javax.preistence.JoinTable; Import javax.preistence.ManyToMany; Import javax.preistence.Table; @Entity @Table (name = "TBL_SPJ_CAST_MOVIE") Public class CastMovie applies Serializable {Personal Static last long serialVersionUID = 1L; @ ID @ generated value (strategy = GenerationType.INDNTITY) @ Column (name = "CAST_MOVIE_ID", unique = true) private Int castID = 0; @ManyToMany (speed = FetchType.LAZY, cascade = {CascadeType.ALL}) @JoinTable (name = "TBL_SPJ_CAST_ROLE", joinColumns = {@ JoinColumn (name = "CAST_MOVIE_ID")}, inverseJoinColumns = {@ JoinColumn (name = "ROLE_ID ")}) Private listing & lt; Role & gt; Roles = null; Public CastMovie () {} public int getCastID () {return castID; } Public Zero Set Casted (Int castID) {this.castID = castID; } Public listing & lt; Role & gt; GetRoles () {Return Roles; } Public Zero Centrol (List & lt; Role & gt; Roles) {this.roles = Roles; }} So what is the point of this error? .
Edit:
Here's the structure of the four tables contained in this problem:
Edit all the data an xml file so I can put in more columns (if thats the problem): < / P>
- a movie Cast - & gt; One relationship with one
- There are many ra ols in many races - & gt;
I had only one problem.
Set> GenerationType to GenerationType.TABLE and this will do the trick. Read Also -
No comments:
Post a Comment