在我的应用程序中,我有@Entity
嵌入一个Request
类,其中包含Issue
属性和Attachment
个列表。
Attachment
也是Issue
Issue
Code
属性为number
和year
,因此我有:
@Embeddable
public class Code{
private Long number;
private Integer year;
}
@Embeddable
public class Issue{
private Code code;
}
@Embeddable
public class Attachment extends Issue{
@ManyToOne
private Category category;
}
@Embeddable
public class Request{
@AttributeOverrides(value={
@AttributeOverride(name="code.year", column=@Column(name="issue_year")),
@AttributeOverride(name="code.number", column=@Column(name="issue_number")),
})
private Issue issue;
@AttributeOverrides(value={
@AttributeOverride(name="code.year", column=@Column(name="attachment_year")),
@AttributeOverride(name="code.number", column=@Column(name="attachment_number")),
})
@ElementCollection
@CollectionTable(name="attachments")
private List<Attachment> attachments;
}
现在的问题是,在生成的表中,我有attachments
表但没有attachment_year
和attachment_number
列!
我做错了什么?