Boa tarde pessoal.
Estou tendo dificuldades em fazer mapeamento entre minhas tabelas.
tenho uma tabela SERVICO uma tabela ITEMSERVICO e uma tabela ORDEMDESERVICO, me ajudem a fazer mapeamento entre elas
@Entity
public class OrdemDeServico {
@Id
@GeneratedValue
private Integer idOrdemDeServico;
private String dataAbertura;
private String Status;
private String obs;
private Float valorTotal;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "ordemDeServico", fetch = FetchType.EAGER)
private List<ItensDeServico> itensDeServico;
@OneToOne(cascade = javax.persistence.CascadeType.PERSIST)
@JoinColumn(name = "id_pessoa")
@Fetch(FetchMode.JOIN)
private Pessoa pessoa;
@OneToOne(cascade = javax.persistence.CascadeType.PERSIST)
@JoinColumn(name = "id_funcionario")
@Fetch(FetchMode.JOIN)
private Funcionario funcionario;
getters and setters
@Entity
public class TipoDeServico {
@Id
@GeneratedValue
private Integer idTipoDeServico;
private Float valor;
private String descricao;
getters and setters
@Entity
public class ItensDeServico {
@Id
@GeneratedValue
private Integer idItensDeServico;
@OneToMany(cascade = javax.persistence.CascadeType.PERSIST)
@JoinColumn(name = "id_tipoDeServico")
@Fetch(FetchMode.JOIN)
private Collection<TipoDeServico> tiposDeServico;
Po me ajudem Obrigado