我可以在Embeddable类中添加多对一的映射。 这里它试图获取值jobCategoryMast direclty。 这是一个映射对象。
抛出异常org.postgresql.util.PSQLException:错误:列jobvaccina0_.jobcategorymast不存在
@Entity
@Table(name="job_vac",schema="cis")
@SuppressWarnings("serial")
public class JobVacc implements java.io.Serializable {
// Fields
@Column(name="default", length=1)
private String default;
@EmbeddedId
private JobVaccPK jobVaccinationPK;
public JobVacc(){
}
//getters and setters
}
// JobVaccPK类
@Embeddable
@SuppressWarnings("serial")
public class JobVaccPK implements Serializable{
/*@Column(name = "job_category_id")
private Long jobCategoryId;*/
private JobCategoryMast jobCategoryMast;
@Column(name = "vaccination_id")
private Long vaccId;
@Column(name = "screening_type_id")
private Long screeningTypeId;
/**
* @return the jobCategoryMast
*/
public JobCategoryMast getJobCategoryMast() {
return jobCategoryMast;
}
/**
* @param jobCategoryMast the jobCategoryMast to set
*/
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="job_category_id")
public void setJobCategoryMast(JobCategoryMast jobCategoryMast) {
this.jobCategoryMast = jobCategoryMast;
}
//other setters and getters