1 package ecar.pojo;
2
3
4
5 import java.util.Date;
6 import javax.persistence.AttributeOverride;
7 import javax.persistence.AttributeOverrides;
8 import javax.persistence.Column;
9 import javax.persistence.EmbeddedId;
10 import javax.persistence.Entity;
11 import javax.persistence.FetchType;
12 import javax.persistence.JoinColumn;
13 import javax.persistence.ManyToOne;
14 import javax.persistence.Table;
15 import javax.persistence.Temporal;
16 import javax.persistence.TemporalType;
17
18
19
20
21 @Entity
22 @Table(name = "TB_AGENDA_ENTIDADES_AGEENT")
23 public class AgendaEntidadesAgeent implements java.io.Serializable, PaiFilho {
24
25 private static final long serialVersionUID = -6047449686851662979L;
26
27 private AgendaEntidadesAgeentPK comp_id;
28 private Date dataInclusaoAgeent;
29 private AgendaAge agendaAge;
30 private EntidadeEnt entidadeEnt;
31 private UsuarioUsu usuarioUsuManutencao;
32
33 public AgendaEntidadesAgeent() {
34 }
35
36 public AgendaEntidadesAgeent(AgendaEntidadesAgeentPK comp_id) {
37 this.comp_id = comp_id;
38 }
39
40 public AgendaEntidadesAgeent(AgendaEntidadesAgeentPK comp_id, Date dataInclusaoAgeent, AgendaAge agendaAge, EntidadeEnt entidadeEnt, UsuarioUsu usuarioUsuManutencao) {
41 this.comp_id = comp_id;
42 this.dataInclusaoAgeent = dataInclusaoAgeent;
43 this.agendaAge = agendaAge;
44 this.entidadeEnt = entidadeEnt;
45 this.usuarioUsuManutencao = usuarioUsuManutencao;
46 }
47
48 @EmbeddedId
49 @AttributeOverrides( { @AttributeOverride(name = "codAge", column = @Column(name = "COD_AGE", nullable = false)), @AttributeOverride(name = "codEnt", column = @Column(name = "COD_ENT", nullable = false)) })
50 public AgendaEntidadesAgeentPK getComp_id() {
51 return this.comp_id;
52 }
53
54 public void setComp_id(AgendaEntidadesAgeentPK comp_id) {
55 this.comp_id = comp_id;
56 }
57
58 @Temporal(TemporalType.TIMESTAMP)
59 @Column(name = "DATA_INCLUSAO_AGEENT", length = 8)
60 public Date getDataInclusaoAgeent() {
61 return this.dataInclusaoAgeent;
62 }
63
64 public void setDataInclusaoAgeent(Date dataInclusaoAgeent) {
65 this.dataInclusaoAgeent = dataInclusaoAgeent;
66 }
67
68 @ManyToOne(fetch = FetchType.LAZY)
69 @JoinColumn(name = "COD_AGE", insertable = false, updatable = false)
70 public AgendaAge getAgendaAge() {
71 return this.agendaAge;
72 }
73
74 public void setAgendaAge(AgendaAge agendaAge) {
75 this.agendaAge = agendaAge;
76 }
77
78 @ManyToOne(fetch = FetchType.LAZY)
79 @JoinColumn(name = "COD_ENT", insertable = false, updatable = false)
80 public EntidadeEnt getEntidadeEnt() {
81 return this.entidadeEnt;
82 }
83
84 public void setEntidadeEnt(EntidadeEnt entidadeEnt) {
85 this.entidadeEnt = entidadeEnt;
86 }
87
88 @ManyToOne(fetch = FetchType.LAZY)
89 @JoinColumn(name = "COD_USU_MANUTENCAO")
90 public UsuarioUsu getUsuarioUsuManutencao() {
91 return this.usuarioUsuManutencao;
92 }
93
94 public void setUsuarioUsuManutencao(UsuarioUsu usuarioUsuManutencao) {
95 this.usuarioUsuManutencao = usuarioUsuManutencao;
96 }
97
98 public void atribuirPKPai() {
99 comp_id = new AgendaEntidadesAgeentPK();
100 comp_id.setCodAge(this.getAgendaAge().getCodAge());
101 comp_id.setCodEnt(this.getEntidadeEnt().getCodEnt());
102 }
103
104 }