Herança em mais de 1 nível

Olá a todos

Estou com uma dúvida em relação à herança

Tenho uma classe abstrata Pessoa, uma classe abstrata Fisica (herda de pessoa) e uma classe Aluno (herda de Fisica).

O banco de dados é em Postgresql, com essas 3 classes trabalhando com herança.

Este tipo de herança abaixo está correta?

Essa annotation “@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)” só vai na primeira superclasse ou na outra também?

Desde já, obrigado.

As classes são:

@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class Pessoa implements Serializable {

private static final long serialVersionUID = 5622021849010487969L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="idpessoa")
private int pessoa;

public int getPessoa() {
    return pessoa;
}

public void setPessoa(int pessoa) {
    this.pessoa = pessoa;
}

@Override
public int hashCode() {
    int hash = 7;
    hash = 43 * hash + this.pessoa;
    return hash;
}

@Override
public boolean equals(Object obj) {
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final Pessoa other = (Pessoa) obj;
    if (this.pessoa != other.pessoa) {
        return false;
    }
    return true;
}

}


@Entity
public abstract class Fisica extends Pessoa implements Serializable {

private static final long serialVersionUID = 5885860216809302450L;
@Column(name = "nome_completo")
private String nomeCompleto;
@Column(name = "cpf")
private String cpf;
@Column(name = "rg")
private String rg;
@Column(name = "data_nascimento")
@Temporal(TemporalType.DATE)
private Date dataNascimento;
@Column(name = "tel_residencial")
private String telResidencial;
@Column(name = "tel_celular")
private String telCelular;

public String getNomeCompleto() {
    return nomeCompleto;
}

public void setNomeCompleto(String nomeCompleto) {
    this.nomeCompleto = nomeCompleto;
}

public String getCpf() {
    return cpf;
}

public void setCpf(String cpf) {
    this.cpf = cpf;
}

public String getRg() {
    return rg;
}

public void setRg(String rg) {
    this.rg = rg;
}

public Date getDataNascimento() {
    return dataNascimento;
}

public void setDataNascimento(Date dataNascimento) {
    this.dataNascimento = dataNascimento;
}

public String getTelResidencial() {
    return telResidencial;
}

public void setTelResidencial(String telResidencial) {
    this.telResidencial = telResidencial;
}

public String getTelCelular() {
    return telCelular;
}

public void setTelCelular(String telCelular) {
    this.telCelular = telCelular;
}

@Override
public int hashCode() {
    int hash = 7;
    hash = 59 * hash + (this.nomeCompleto != null ? this.nomeCompleto.hashCode() : 0);
    hash = 59 * hash + (this.cpf != null ? this.cpf.hashCode() : 0);
    hash = 59 * hash + (this.rg != null ? this.rg.hashCode() : 0);
    hash = 59 * hash + (this.dataNascimento != null ? this.dataNascimento.hashCode() : 0);
    hash = 59 * hash + (this.telResidencial != null ? this.telResidencial.hashCode() : 0);
    hash = 59 * hash + (this.telCelular != null ? this.telCelular.hashCode() : 0);
    return hash;
}

@Override
public boolean equals(Object obj) {
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final Fisica other = (Fisica) obj;
    if ((this.nomeCompleto == null) ? (other.nomeCompleto != null) : !this.nomeCompleto.equals(other.nomeCompleto)) {
        return false;
    }
    if ((this.cpf == null) ? (other.cpf != null) : !this.cpf.equals(other.cpf)) {
        return false;
    }
    if ((this.rg == null) ? (other.rg != null) : !this.rg.equals(other.rg)) {
        return false;
    }
    if (this.dataNascimento != other.dataNascimento && (this.dataNascimento == null || !this.dataNascimento.equals(other.dataNascimento))) {
        return false;
    }
    if ((this.telResidencial == null) ? (other.telResidencial != null) : !this.telResidencial.equals(other.telResidencial)) {
        return false;
    }
    if ((this.telCelular == null) ? (other.telCelular != null) : !this.telCelular.equals(other.telCelular)) {
        return false;
    }
    return true;
}

}


@Entity
public class Aluno extends Fisica implements Serializable {

private static final long serialVersionUID = 7724120084226092997L;
@Column(name = "matricula")
@org.hibernate.annotations.NaturalId
private String matricula;
@Column(name = "sexo")
private String sexo;
@Column(name = "estado_civil")
private String estadoCivil;
@Column(name = "onde_conheceu")
private String ondeConheceu;
@Column(name = "quem_indicou")
private String quemIndicou;
@Column(name = "opiniao")
private String opiniao;
@Column(name = "dia_disponivel")
@Temporal(TemporalType.DATE)
private Date diaDisponivel;
@Column(name = "turno_disponivel")
private String turnoDisponivel;

public String getMatricula() {
    return matricula;
}

public void setMatricula(String matricula) {
    this.matricula = matricula;
}

public String getSexo() {
    return sexo;
}

public void setSexo(String sexo) {
    this.sexo = sexo;
}

public String getEstadoCivil() {
    return estadoCivil;
}

public void setEstadoCivil(String estadoCivil) {
    this.estadoCivil = estadoCivil;
}

public String getOndeConheceu() {
    return ondeConheceu;
}

public void setOndeConheceu(String ondeConheceu) {
    this.ondeConheceu = ondeConheceu;
}

public String getQuemIndicou() {
    return quemIndicou;
}

public void setQuemIndicou(String quemIndicou) {
    this.quemIndicou = quemIndicou;
}

public String getOpiniao() {
    return opiniao;
}

public void setOpiniao(String opiniao) {
    this.opiniao = opiniao;
}

public Date getDiaDisponivel() {
    return diaDisponivel;
}

public void setDiaDisponivel(Date diaDisponivel) {
    this.diaDisponivel = diaDisponivel;
}

public String getTurnoDisponivel() {
    return turnoDisponivel;
}

public void setTurnoDisponivel(String turnoDisponivel) {
    this.turnoDisponivel = turnoDisponivel;
}

@Override
public int hashCode() {
    int hash = 7;
    hash = 89 * hash + (this.matricula != null ? this.matricula.hashCode() : 0);
    hash = 89 * hash + (this.sexo != null ? this.sexo.hashCode() : 0);
    hash = 89 * hash + (this.estadoCivil != null ? this.estadoCivil.hashCode() : 0);
    hash = 89 * hash + (this.ondeConheceu != null ? this.ondeConheceu.hashCode() : 0);
    hash = 89 * hash + (this.quemIndicou != null ? this.quemIndicou.hashCode() : 0);
    hash = 89 * hash + (this.opiniao != null ? this.opiniao.hashCode() : 0);
    hash = 89 * hash + (this.diaDisponivel != null ? this.diaDisponivel.hashCode() : 0);
    hash = 89 * hash + (this.turnoDisponivel != null ? this.turnoDisponivel.hashCode() : 0);
    return hash;
}

@Override
public boolean equals(Object obj) {
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final Aluno other = (Aluno) obj;
    if ((this.matricula == null) ? (other.matricula != null) : !this.matricula.equals(other.matricula)) {
        return false;
    }
    if ((this.sexo == null) ? (other.sexo != null) : !this.sexo.equals(other.sexo)) {
        return false;
    }
    if ((this.estadoCivil == null) ? (other.estadoCivil != null) : !this.estadoCivil.equals(other.estadoCivil)) {
        return false;
    }
    if ((this.ondeConheceu == null) ? (other.ondeConheceu != null) : !this.ondeConheceu.equals(other.ondeConheceu)) {
        return false;
    }
    if ((this.quemIndicou == null) ? (other.quemIndicou != null) : !this.quemIndicou.equals(other.quemIndicou)) {
        return false;
    }
    if ((this.opiniao == null) ? (other.opiniao != null) : !this.opiniao.equals(other.opiniao)) {
        return false;
    }
    if (this.diaDisponivel != other.diaDisponivel && (this.diaDisponivel == null || !this.diaDisponivel.equals(other.diaDisponivel))) {
        return false;
    }
    if ((this.turnoDisponivel == null) ? (other.turnoDisponivel != null) : !this.turnoDisponivel.equals(other.turnoDisponivel)) {
        return false;
    }
    return true;
}

}

Este tipo de herança está correta?

Desde já, obrigado.

http://www.guj.com.br/java/15777-antes-de-voce-perguntar

http://www.guj.com.br/java/287484-gujnautas-how-to

http://www.guj.com.br/java/50115-voce-e-novo-no-guj-vai-criar-um-topico-e-colar-seu-codigo-fonte-leia-aqui-antes-por-favor