这是我的代码:
@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
通用数据可以具有来自其他通用数据的0个或多个
ìnbounds
。通用数据相对于其他通用数据可以具有0或更大的
outbounds
。运行此代码时,出现以下异常:
Caused by: org.hibernate.AnnotationException: @OneToOne or @ManyToOne
on my.domain.Video.inbounds references an unknown entity: java.util.Set
我想念什么?
最佳答案
@ManyToOne
应该存储一件事。使用:
@ManyToOne
private GenericData inbounds;