“mappedBy”引用未知的目标实体属性:在JPA中的一对多映射中

时间:2013-01-23 16:17:25

标签: hibernate jpa

我收到以下异常

"org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.vzbi.impact.iam.common.models.AutomationCFScripting.ruleId in com.vzbi.impact.iam.common.models.AutomationScriptIds.multiTabSet"

我拥有的实体架构如下,

//trying to map from rowId of AutomationScriptIds to ruleId of AutomationCFScripting with one-to-many
//both rowId and ruleId is available in entity Category which is extended by AutomationScriptIds and AutomationCFScripting


@Entity
@Table(name="AUTOMATION_SCRIPT_IDS")
public class AutomationScriptIds extends Category implements Serializable, MultiTabCategory {
---
     @OneToMany(cascade=CascadeType.ALL, targetEntity=AutomationCFScripting.class, mappedBy="ruleId",       fetch=FetchType.EAGER)             
     public Set<? extends Category> getMultiTabSet() {        
        return getSetValue(RuleFieldKeys.MULTITAB);
    }
---
}



@Entity
@Table(name="AUTOMATION_CFSCRIPTING")
public class AutomationCFScripting extends Category implements java.io.Serializable{
-----
}


@Entity
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
public abstract class Category extends DataMap
{
---
    @Id
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid")
    @Column(name="ROW_ID")
    public String getRowId() {
        return getStringValue(RuleFieldKeys.ROW_ID);
    }

    @Column(name="RULE_ID")
    public String getRuleId() {
        return getStringValue(RuleFieldKeys.RULE_ID);
    }
---
}

0 个答案:

没有答案