1

既存の構造に休止状態の継承を追加しようとしています。したがって、3 つのエンティティを一般化する親クラスを追加する必要があります。問題は、子から HQL で継承されたフィールドを取得する必要があることです。このようなもの:

@Table(name="parents")
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
public class Parent{
@Id
Long id;

 //additional code with protected getter and setter for id
}

@Table(name="childs")
@Entity
@PrimaryKeyJoinColumn(name="id")
public class Child extends Parent{

@Transient
public void setChildId(Long id){
super.setId(id);
}

@Transient
public Long getChildId(){
return super.getId();
}

HQLのように実行しようとしているときに、このコードで最後に

select c from Child c

「不明な列 childs.id」という SQL エラーがあります。

どうしたの?

4

0 に答える 0