1 package ecar.pojo;
2
3
4
5 import javax.persistence.AttributeOverride;
6 import javax.persistence.AttributeOverrides;
7 import javax.persistence.Column;
8 import javax.persistence.EmbeddedId;
9 import javax.persistence.Entity;
10 import javax.persistence.FetchType;
11 import javax.persistence.JoinColumn;
12 import javax.persistence.ManyToOne;
13 import javax.persistence.Table;
14
15
16
17
18 @Entity
19 @Table(name = "tb_servico_parametro_serpar")
20 public class ServicoParametroSerPar implements java.io.Serializable, PaiFilho {
21
22 private static final long serialVersionUID = 7933539196725798929L;
23
24 private ServicoParametroSerParPK comp_id;
25 private ServicoSer servicoSer;
26 private ParametroPar parametroPar;
27 private Long sequencia;
28
29 public ServicoParametroSerPar() {
30 }
31
32 public ServicoParametroSerPar(ServicoParametroSerParPK comp_id) {
33 this.comp_id = comp_id;
34 }
35
36 public ServicoParametroSerPar(ServicoParametroSerParPK comp_id, ServicoSer servicoSer, ParametroPar parametroPar, Long sequencia) {
37 this.comp_id = comp_id;
38 this.servicoSer = servicoSer;
39 this.parametroPar = parametroPar;
40 this.sequencia = sequencia;
41 }
42
43 @EmbeddedId
44 @AttributeOverrides( { @AttributeOverride(name = "codServicoSerPar", column = @Column(name = "COD_SERVICO_SER", nullable = false)), @AttributeOverride(name = "codParametroSerPar", column = @Column(name = "COD_PARAMETRO_PAR", nullable = false)) })
45 public ServicoParametroSerParPK getComp_id() {
46 return this.comp_id;
47 }
48
49 public void setComp_id(ServicoParametroSerParPK comp_id) {
50 this.comp_id = comp_id;
51 }
52
53 @ManyToOne(fetch = FetchType.LAZY)
54 @JoinColumn(name = "COD_SERVICO_SER", insertable = false, updatable = false)
55 public ServicoSer getServicoSer() {
56 return this.servicoSer;
57 }
58
59 public void setServicoSer(ServicoSer servicoSer) {
60 this.servicoSer = servicoSer;
61 }
62
63 @ManyToOne(fetch = FetchType.LAZY)
64 @JoinColumn(name = "COD_PARAMETRO_PAR", insertable = false, updatable = false)
65 public ParametroPar getParametroPar() {
66 return this.parametroPar;
67 }
68
69 public void setParametroPar(ParametroPar parametroPar) {
70 this.parametroPar = parametroPar;
71 }
72
73 @Column(name = "sequencia")
74 public Long getSequencia() {
75 return this.sequencia;
76 }
77
78 public void setSequencia(Long sequencia) {
79 this.sequencia = sequencia;
80 }
81
82 public void atribuirPKPai() {
83 comp_id = new ServicoParametroSerParPK();
84 comp_id.setCodParametroSerPar(this.getParametroPar().getCodParametroPar());
85 comp_id.setCodServicoSerPar(this.getServicoSer().getCodServicoSer());
86 }
87
88 }