親クラスがあります:
@MappedSuperclass
public class BaseText implements Serializable {
@Column(name = "LOCALE_CODE", nullable = false)
private String localeCode;
@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@Index
@Column(name = "LOCALIZED_TEXT_ID", nullable = false)
@ForeignKey
private LocalizedText localizedText;
//getters and setters
}
サブクラスの 1 つ:
@Entity
@Table(name = "ASSESSMENT_TEXT")
@AttributeOverride(name = "localeCode", column = @Column(name = "LOCALE_CODE"))
@AssociationOverride(name = "localizedText", joinColumns = @JoinColumn(name = "LOCALIZED_TEXT_ID"))
public class AssessmentText extends BaseText {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID")
private Long id;
@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@Index
@Column(name = "ASSESSMENT_ID", nullable = false)
@ForeignKey
private Assessment assessment;
//Getters and setters.
}
オブジェクトを永続化しようとすると、次のエラーが発生します。
org.apache.openjpa.persistence.ArgumentException: Superclass field "java.lang.Object.localizedText" is mapped in the metadata for subclass "com.my.com.AssessmentText", but is not a persistent field.
これを引き起こしている原因と解決方法は?
私は JUnit に埋め込まれた derby データベースを使用しており、JPA 実装は OpenJPA です。