我有课:
@SecondaryTables(
{
@SecondaryTable(
name = ReaEconomicAgentCatalog.TABLE_NAME
, pkJoinColumns =
{
@PrimaryKeyJoinColumn(
name = "rea_economic_agent_catalog_id"
, referencedColumnName = "eav_entity_id"
)
}
)
}
)
public class ReaEconomicAgentCatalog
extends EavEntity
implements HasZonedAvailabilityPeriod
, Serializable
{
...
@JoinTable(
inverseJoinColumns = @JoinColumn(
name = "rea_economic_resource_kind_id"
, referencedColumnName = "rea_economic_resource_kind_id"
)
, joinColumns = @JoinColumn(
name = "rea_economic_agent_catalog_id"
, referencedColumnName = "rea_economic_agent_catalog_id"
)
, name = "rea_economic_agent_catalog_resources"
)
@ManyToMany(
fetch = FetchType.LAZY
, targetEntity = ReaEconomicResourceKind.class
)
private Set<ReaEconomicResourceKind> reaEconomicResourceKinds;
我们收到这个错误:
Caused by: org.hibernate.AnnotationException: referencedColumnNames(rea_economic_agent_catalog_id) of com.corbettcode.rea.model.policy.ReaEconomicResourceKind.reaEconomicResourceKinds referencing com.corbettcode.rea.model.accountability.agent.ReaEconomicAgentCatalog not mapped to a single property
at org.hibernate.cfg.BinderHelper.createSyntheticPropertyReference(BinderHelper.java:203)
at org.hibernate.cfg.annotations.CollectionBinder.bindCollectionSecondPass(CollectionBinder.java:1740)
到目前为止我们知道的是“rea_economic_agent_catalog_id”不在类的属性列表中,这就是抛出异常的原因。
这是在 eclipselink 中运行的代码,正在迁移到 hibernate。我知道这可能很简单,但我们就是想不通。任何帮助将不胜感激。
尝试运行单元测试。期待不会失败。