Hi all!
Firstly, excuse my english!
Class Empresa
Code:
@Entity
public class Empresa {
@Id @GeneratedValue
private Integer empresa;
set/get
}
Class Pessoa Pk is composed by Empresa and Integer
Code:
@Entity
public class Pessoa{
@EmbeddedId
private PessoaId pessoaId;
set/get
}
Class PessoaId
Code:
@Embeddable
public class PessoaId implements Serializable{
@ManyToOne
@JoinColumn(name="empresa")
private Empresa empresa;
private Integer pessoa;
set/get
}
I need that primary key of the Class Funcionario is a Foreing Key of the Class Pessoa
Class FuncionarioId
Code:
@Embeddable
public class FuncionarioId implements Serializable{
@ManyToOne
@JoinColumn(name="empresa")
private Empresa empresa;
//My doubt is here, I Don't know do this anotation, I need that Id (Pk) of Funcionario is a Foreing Key of the Class Pessoa
set/get
}
Class Funcionario
Code:
@Entity
public class Funcionario{
@EmbeddedId
private FuncioarioId funcionarioId;
set/get
}