我有两个这样的课程
package models;
import java.util.*;
import javax.persistence.*;
import play.db.jpa.*;
@Entity
@Table(name = "commitment_type_value")
public class CommittmentTypeValue extends Model{
@Id
@Column(name = "id", nullable = false)
public Long id;
@Column(name = "value", nullable = true)
public String type;
@ManyToOne
@JoinColumn(name="commitment_type_id")
public CommitementType commitmentType;
public CommittmentTypeValue(){
}
}
-------------
package models;
import java.util.*;
import javax.persistence.*;
import play.db.jpa.*;
/**
*
* @author hatem
*/
@Entity
@Table(name = "commitment_type")
public class CommitementType extends Model{
@Id
@Column(name = "id", nullable = false)
public Long id;
@Column(name = "type", nullable = true)
public String type;
@OneToMany(fetch=FetchType.LAZY, cascade = CascadeType.ALL, mappedBy="commitmentType")
public List<CommittmentTypeValue> commitmentTypeValues;
public CommitementType(){
}
}
当我执行我的应用程序时,会出现此问题:
发生 JPA 错误(无法构建 EntityManagerFactory):从 models.CommittmentTypeValue 引用 models.CommitementType 的外键具有错误的列数。应该是 2
拜托,谁能告诉我怎么了?