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 import javax.persistence.Transient;
15
16
17
18
19 @Entity
20 @Table(name = "TB_COR_TIPO_FUNC_ACOMP_CTFA")
21 public class CorTipoFuncAcompCtfa implements java.io.Serializable, PaiFilho {
22
23 private static final long serialVersionUID = -5909048297308738576L;
24
25 private CorTipoFuncAcompCtfaPK comp_id;
26 private String caminhoImagemCtfa;
27 private Cor cor;
28 private TipoFuncAcompTpfa tipoFuncAcompTpfa;
29 private String posicaoCtfa;
30
31 public CorTipoFuncAcompCtfa() {
32 }
33
34 public CorTipoFuncAcompCtfa(CorTipoFuncAcompCtfaPK comp_id) {
35 this.comp_id = comp_id;
36 }
37
38 public CorTipoFuncAcompCtfa(CorTipoFuncAcompCtfaPK comp_id, String caminhoImagemCtfa, Cor cor, TipoFuncAcompTpfa tipoFuncAcompTpfa) {
39 this.comp_id = comp_id;
40 this.caminhoImagemCtfa = caminhoImagemCtfa;
41 this.cor = cor;
42 this.tipoFuncAcompTpfa = tipoFuncAcompTpfa;
43 }
44
45 @EmbeddedId
46 @AttributeOverrides( { @AttributeOverride(name = "codCor", column = @Column(name = "COD_COR", nullable = false, length = 10)), @AttributeOverride(name = "codTpfa", column = @Column(name = "COD_TPFA", nullable = false, length = 10)), @AttributeOverride(name = "posicaoCtfa", column = @Column(name = "POSICAO_CTFA", nullable = false, length = 1)) })
47 public CorTipoFuncAcompCtfaPK getComp_id() {
48 return this.comp_id;
49 }
50
51 public void setComp_id(CorTipoFuncAcompCtfaPK comp_id) {
52 this.comp_id = comp_id;
53 }
54
55 @Column(name = "CAMINHO_IMAGEM_CTFA", length = 100)
56 public String getCaminhoImagemCtfa() {
57 return this.caminhoImagemCtfa;
58 }
59
60 public void setCaminhoImagemCtfa(String caminhoImagemCtfa) {
61 this.caminhoImagemCtfa = caminhoImagemCtfa;
62 }
63
64 @ManyToOne(fetch = FetchType.LAZY)
65 @JoinColumn(name = "COD_COR", insertable = false, updatable = false)
66 public Cor getCor() {
67 return this.cor;
68 }
69
70 public void setCor(Cor cor) {
71 this.cor = cor;
72 }
73
74 @ManyToOne(fetch = FetchType.LAZY)
75 @JoinColumn(name = "COD_TPFA", insertable = false, updatable = false)
76 public TipoFuncAcompTpfa getTipoFuncAcompTpfa() {
77 return this.tipoFuncAcompTpfa;
78 }
79
80 public void setTipoFuncAcompTpfa(TipoFuncAcompTpfa tipoFuncAcompTpfa) {
81 this.tipoFuncAcompTpfa = tipoFuncAcompTpfa;
82 }
83
84 public void setPosicaoCtfa(String posicaoCtfa) {
85 this.posicaoCtfa = posicaoCtfa;
86 }
87
88 @Transient
89 public String getPosicaoCtfa() {
90 return posicaoCtfa;
91 }
92
93 public void atribuirPKPai() {
94 comp_id = new CorTipoFuncAcompCtfaPK();
95 comp_id.setCodCor(this.getCor().getCodCor());
96 comp_id.setCodTpfa(this.getTipoFuncAcompTpfa().getCodTpfa());
97 }
98
99 }