Caused by: org.hibernate.AnnotationException: referencedColumnNames(form_no, form_type) of A referencing B not mapped to a single property
Caused by: org.hibernate.AnnotationException: referencedColumnNames(form_no, form_type) of com.xxx.epo.service.dao.entity.EpoDetail.epoDetails referencing com.xxx.epo.service.dao.entity.EpoHeader not mapped to a single property at org.hibernate.cfg.BinderHelper.createSyntheticPropertyReference(BinderHelper.java:320) at org.hibernate.cfg.annotations.CollectionBinder.bindCollectionSecondPass(CollectionBinder.java:1545) ... 58 more
1. Form_no1 and form_no1 are not configured in the Header entity or are configured correctly, and are configured in the @Embedded object, which causes JPA to not recognize it normally.
@OneToMany(fetch = FetchType.EAGER) @JoinColumns ({ @JoinColumn(name="form_no",referencedColumnName = "form_no1",insertable = false, updatable = false), @JoinColumn(name="form_type",referencedColumnName = "form_type1",insertable = false, updatable = false) }) private List<EpoDetail> epoDetails;
Add the following configuration to the Header to solve the problem.
@Column(name = "form_type1", insertable = false, updatable = false) Integer formType; @Column(name = "form_no1", insertable = false, updatable = false) Integer formNo;
2. Other situations. . . .