当我执行时EntityManager.find()抛出以下异常:
引起:com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:字段列表中的列“日期”不明确
我试图找到的类(配置文件)与另一个实体类(图库)具有双向的一对一关系。我很感激帮助理解why这个异常被抛出并how解决它。下面是两个实体类:
public class Profile {
...
private java.sql.Date date;
private my.webapp.Gallery gallery;
...
@OneToOne
@JoinColumn(name="gallery_id")
public my.webapp.Gallery getGallery() {
return gallery
}
...
}
public class Gallery {
...
private my.webapp.Profile profile;
...
@OneToOne(mappedBy="gallery")
public my.webapp.Profile getProfile() {
return profile
}
...
}