atendendo ao pedido do Igor, segue os codigos:
Class PessoaFisica
@MappedSuperclass
@Entity
@Table(name = "pessoa_fisica")
@Inheritance(strategy=InheritanceType.JOINED)
public class PessoaFisica {
/**
* Pessoa Fisica ID
*/
@Id
@SequenceGenerator(name = "generator", sequenceName = "pessoa_fisica_id_seq", initialValue = 1, allocationSize = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "generator")
@Column(name = "pessoa_fisica_id", length = 10,
nullable = false, updatable = false)
private int pessoaFisicaId;
/**
* Nome
*/
@Column(name = "nome", length = 180, nullable = true)
private String nome;
/**
* RG
*/
@Column(name = "rg", length = 40, nullable = true)
private String rg;
/**
* CPF
*/
@Column(name = "cpf", length = 14, nullable = true)
private String cpf;
/**
* Endereço
*/
@Column(name = "endereco", length = 80, nullable = true)
private String endereco;
/**
* Bairro
*/
@Column(name = "bairro", length = 40, nullable = true)
private String bairro;
/**
* Cidade
*/
@Column(name = "cidade", length = 80, nullable = true)
private String cidade;
/**
* Estado
*/
@Column(name = "estado", length = 2, nullable = true)
private String estado;
/**
* Cep
*/
@Column(name = "cep", length = 8, nullable = true)
private int cep;
/**
* Fone Residencial
*/
@Column(name = "fone_res", length = 14, nullable = true)
private String foneResidencial;
/**
* Data Nascimento
*/
@Column(name = "data_nasc", nullable = true)
private Date dataNascimento;
/**
* Fone Celular
*/
@Column(name = "fone_cel", length = 14, nullable = true)
private String foneCelular;
/**
* Fax
*/
@Column(name = "fax", length = 14, nullable = true)
private String fax;
/**
* Sexo
*/
@Column(name = "sexo", length = 14, nullable = true)
private String sexo;
/**
* Pai
*/
@Column(name = "pai", length = 80, nullable = true)
private String pai;
/**
* Mãe
*/
@Column(name = "mae", length = 80, nullable = true)
private String mae;
public int getPessoaFisicaId(){
return pessoaFisicaId;
}
public void setPessoaFisicaId(int newVal){
pessoaFisicaId = newVal;
}
public String getNome(){
return nome;
}
public void setNome(String newVal){
nome = newVal;
}
public String getRg(){
return rg;
}
public void setRg(String newVal){
rg = newVal;
}
public String getCpf(){
return cpf;
}
public void setCpf(String newVal){
cpf = newVal;
}
public String getEndereco(){
return endereco;
}
public void setEndereco(String newVal){
endereco = newVal;
}
public String getBairro(){
return bairro;
}
public void setBairro(String newVal){
bairro = newVal;
}
public String getCidade(){
return cidade;
}
public void setCidade(String newVal){
cidade = newVal;
}
public String getEstado(){
return estado;
}
public void setEstado(String newVal){
estado = newVal;
}
public int getCep(){
return cep;
}
public void setCep(int newVal){
cep = newVal;
}
public String getFoneResidencial(){
return foneResidencial;
}
public void setFoneResidencial(String newVal){
foneResidencial = newVal;
}
public Date getDataNascimento(){
return dataNascimento;
}
public void setDataNascimento(Date newVal){
dataNascimento = newVal;
}
public String getFoneCelular(){
return foneCelular;
}
public void setFoneCelular(String newVal){
foneCelular = newVal;
}
public String getFax(){
return fax;
}
public void setFax(String newVal){
fax = newVal;
}
public String getSexo(){
return sexo;
}
public void setSexo(String newVal){
sexo = newVal;
}
public String getPai(){
return pai;
}
public void setPai(String newVal){
pai = newVal;
}
public String getMae(){
return mae;
}
public void setMae(String newVal){
mae = newVal;
}
}
Class Aluno
@Entity
@Table(name = "aluno")
public class Aluno extends PessoaFisica {
/**
* Aluno Id
*/
@Id
@SequenceGenerator(name = "generator", sequenceName = "aluno_id_seq", initialValue = 1, allocationSize = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "generator")
@Column(name = "aluno_id", length = 10,
nullable = false, updatable = false)
private Integer AlunoId;
/**
* Materias
*/
@ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE},
mappedBy="alunos",
targetEntity = Materia.class)
private List<Materia> materias;
/**
* Observações de Saúde
*/
@Column(name = "observacaoSaude", length = 255, nullable = true)
private String observacaoSaude;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="turma_id",
insertable=true, updatable=true)
@Fetch(FetchMode.JOIN)
@Cascade(org.hibernate.annotations.CascadeType.SAVE_UPDATE)
private Turma turmas;
public List<Materia> getMaterias(){
return materias;
}
public void setMaterias(List<Materia> newVal){
materias = newVal;
}
public String getObservacaoSaude(){
return observacaoSaude;
}
public void setObservacaoSaude(String newVal){
observacaoSaude = newVal;
}
public Turma getTurmas() {
return turmas;
}
public void setTurmas(Turma turmas) {
this.turmas = turmas;
}
}
Class Funcionario
@Entity
@Table(name = "funcionario")
public class Funcionario extends PessoaFisica {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="materia_id",
insertable=true, updatable=true)
@Fetch(FetchMode.JOIN)
@Cascade(org.hibernate.annotations.CascadeType.SAVE_UPDATE)
private Materia materias;
/**
* Funcionário Id
*/
@Id
@SequenceGenerator(name = "generator", sequenceName = "funcionario_id_seq", initialValue = 1, allocationSize = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "generator")
@Column(name = "funcionario_id", length = 10,
nullable = false, updatable = false)
private int funcionarioId;
/**
* CTPS
*/
@Column(name = "ctps", length = 20, nullable = true)
private String ctps;
/**
* Tipo de Contratação
*/
@Column(name = "tipo_contratacao", length = 10, nullable = true)
private String tipoContratacao;
/**
* Status
*/
@Column(name = "status", length = 10, nullable = true)
private String status;
/**
* Data da Contratação
*/
@Column(name = "data_contratacao", nullable = true)
private Date dataContratacao;
/**
* Função
*/
@Column(name = "funcao", length = 40, nullable = true)
private String funcao;
/**
* É um Professor
*/
@Column(name = "professor", nullable = true)
private boolean isProfessor;
public int getFuncionarioId(){
return funcionarioId;
}
public void setFuncionarioId(int newVal){
funcionarioId = newVal;
}
public String getCtps(){
return ctps;
}
public void setCtps(String newVal){
ctps = newVal;
}
public String getTipoContratacao(){
return tipoContratacao;
}
public void setTipoContratacao(String newVal){
tipoContratacao = newVal;
}
public String getStatus(){
return status;
}
public void setStatus(String newVal){
status = newVal;
}
public Date getDataContratacao(){
return dataContratacao;
}
public void setDataContratacao(Date newVal){
dataContratacao = newVal;
}
public String getFuncao(){
return funcao;
}
public void setFuncao(String newVal){
funcao = newVal;
}
public boolean isIsProfessor(){
return isProfessor;
}
public void setIsProfessor(boolean newVal){
isProfessor = newVal;
}
public Materia getMaterias() {
return materias;
}
public void setMaterias(Materia materias) {
this.materias = materias;
}
}