我有课程Document
,其中包含带Ad ad
注释的字段@OneToOne
。
类ResultDocument扩展Document,应用JOINED
继承策略。当我启动我的应用程序时,我收到错误:
org.hibernate.MappingException: property [ad] not found on entity [ua.translate.model.ad.ResultDocument]
请解释我这个错误的原因。
班级文件:
@Entity
@Table(name = "INIT_DOCUMENT_TEST")
@Inheritance(strategy = InheritanceType.JOINED)
public class Document {
@Id
@SequenceGenerator(name = "standart",initialValue = 1)
@GeneratedValue(generator = "standart",strategy =GenerationType.SEQUENCE)
@Column(name = "DOCUMENT_ID")
private long id;
@Lob
@Column(name = "DOCUMENT_FILE",nullable = false)
private byte[] file;
@Column(name = "DOCUMENT_FILE_NAME",nullable = false)
private String fileName;
@Column(name = "DOCUMENT_CONTENT_TYPE",nullable = false)
private String contentType;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "DOCUMENT_AD_ID")
private Ad ad;
.....
}
class ResultDocument:
@Entity
@Table(name = "RESULT_DOCUMENT_TEST")
@PrimaryKeyJoinColumn(name= "result_document_id")
public class ResultDocument extends Document{
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "TRANSLATOR",nullable = false)
private Translator downloader;
.....
}
答案 0 :(得分:0)
我认为您不应该从Document扩展,因为如果您使用的是hibernate或JPA,则该技术使用该关系而不执行继承。