这是我的代码:
@MappedSuperclass
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class GenericData {
@Id
@Column(length = 1024)
private String url;
@Temporal(TemporalType.TIMESTAMP)
private Date lastUpdated;
@ManyToOne
private Set<GenericData> inbounds = new HashSet<GenericData>();
@OneToMany
private Set<GenericData> outbounds = new HashSet<GenericData>();
// Getters, setters and rest of class ...
} // End of class
ìnbounds
。outbounds
个其他通用数据。当我运行此代码时,我得到了这个例外:
Caused by: org.hibernate.AnnotationException: @OneToOne or @ManyToOne
on my.domain.Video.inbounds references an unknown entity: java.util.Set
我错过了什么?
答案 0 :(得分:3)
@ManyToOne
应存储一件事。使用:
@ManyToOne
private GenericData inbounds;