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_orgao_periodo_exercicio_orgperexe")
20 public class OrgaoPeriodoExercicioOrgPerExe implements java.io.Serializable, PaiFilho {
21
22 private static final long serialVersionUID = -355092136839877646L;
23
24 private OrgaoPeriodoExercicioOrgPerExePK compId;
25 private String indAtivoOrgPerExe;
26 private OrgaoOrg orgaoOrg;
27 private PeriodoExercicioPerExe periodoExercicioPerExe;
28
29 public OrgaoPeriodoExercicioOrgPerExe() {
30 }
31
32 public OrgaoPeriodoExercicioOrgPerExe(OrgaoPeriodoExercicioOrgPerExePK compId) {
33 this.compId = compId;
34 }
35
36 public OrgaoPeriodoExercicioOrgPerExe(OrgaoPeriodoExercicioOrgPerExePK compId, String indAtivoOrgPerExe, OrgaoOrg orgaoOrg, PeriodoExercicioPerExe periodoExercicioPerExe) {
37 this.compId = compId;
38 this.indAtivoOrgPerExe = indAtivoOrgPerExe;
39 this.orgaoOrg = orgaoOrg;
40 this.periodoExercicioPerExe = periodoExercicioPerExe;
41 }
42
43 @EmbeddedId
44 @AttributeOverrides( { @AttributeOverride(name = "codOrg", column = @Column(name = "cod_org", nullable = false, length = 10)), @AttributeOverride(name = "codPerExe", column = @Column(name = "cod_perexe", nullable = false, length = 10)) })
45 public OrgaoPeriodoExercicioOrgPerExePK getCompId() {
46 return this.compId;
47 }
48
49 public void setCompId(OrgaoPeriodoExercicioOrgPerExePK compId) {
50 this.compId = compId;
51 }
52
53 @Column(name = "ind_ativo_orgperexe", length = 1)
54 public String getIndAtivoOrgPerExe() {
55 return this.indAtivoOrgPerExe;
56 }
57
58 public void setIndAtivoOrgPerExe(String indAtivoOrgPerExe) {
59 this.indAtivoOrgPerExe = indAtivoOrgPerExe;
60 }
61
62 @ManyToOne(fetch = FetchType.LAZY)
63 @JoinColumn(name = "cod_org", insertable = false, updatable = false)
64 public OrgaoOrg getOrgaoOrg() {
65 return this.orgaoOrg;
66 }
67
68 public void setOrgaoOrg(OrgaoOrg orgaoOrg) {
69 this.orgaoOrg = orgaoOrg;
70 }
71
72 @ManyToOne(fetch = FetchType.LAZY)
73 @JoinColumn(name = "cod_perexe", insertable = false, updatable = false)
74 public PeriodoExercicioPerExe getPeriodoExercicioPerExe() {
75 return this.periodoExercicioPerExe;
76 }
77
78 public void setPeriodoExercicioPerExe(PeriodoExercicioPerExe periodoExercicioPerExe) {
79 this.periodoExercicioPerExe = periodoExercicioPerExe;
80 }
81
82 public void atribuirPKPai() {
83 compId = new OrgaoPeriodoExercicioOrgPerExePK();
84 compId.setCodOrg(this.getOrgaoOrg().getCodOrg());
85 compId.setCodPerExe(this.getPeriodoExercicioPerExe().getCodPerExe());
86 }
87
88 }