我有4類,如下之間的多對一關係......如何定義兩個抽象類
@MappedSuperclass
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
public abstract class Platform{
@Id
@Column(name = "PLATFORM_ID")
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer platformId;
...
@Entity
@Table(name = "ANDROID_PLATFORM")
public class AndroidPlatform extends Platform{
public AndroidPlatform(){
}
...
@MappedSuperclass
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
public abstract class Application{
@Id
@Column(name = "APPLICATION_ID")
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer applicationId;
@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name="PLATFORM_ID")
private Platform platform;
...
@Entity
@Table(name = "ANDROID_APPLICATION")
public class AndroidApplication extends Application {
public AndroidApplication(){
}
...
當我開始我的項目是什麼錯了,它會拋出這樣的
org.hibernate.AnnotationException: @OneToOne or @ManyToOne on com.***.model.AndroidApplication.platform references an unknown entity: com.***.model.Platform
...
錯誤在我的類中,或者什麼是在hibernate中使用抽象類的最佳方法?
請幫忙。