【发布时间】:2016-04-14 06:43:25
【问题描述】:
我希望有人可以帮助我找出我在使用休眠时遇到的问题。
我正在开发一个可以为不同类型的实体开具发票的计费系统。实体实现了“Invoicable”接口。
在我的发票类中,我有这一行
@ManyToOne(fetch = FetchType.EAGER)
private Invoiceable responsibleEntity;
发票界面如下所示
@MappedSuperclass
public interface Invoiceable
{
// Name to display as entity responsible
String getInvoiceOwnerName();
// Get email address to send invoice
String getInvoiceOwnerEmail();
}
我在运行时遇到异常
org.hibernate.AnnotationException:models.Invoice.responsibleEntity 上的 @OneToOne 或 @ManyToOne 引用了未知实体:interfaces.Invoiceable
我试过用谷歌搜索它并阅读一些类似的帖子,但我什么也做不了。 hibernate 是否支持这种类型的映射?
谢谢
【问题讨论】: