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_SEGMENTO_SIS_ATRIB_SGTSA")
20 public class SegmentoSisAtribSgtsa implements java.io.Serializable, PaiFilho {
21
22 private static final long serialVersionUID = 4352261710005034940L;
23
24 private SegmentoSisAtribSgtsaPK comp_id;
25 private SegmentoItemSgti SegmentoItemSgti;
26 private SisAtributoSatb SisAtributoSatb;
27
28 public SegmentoSisAtribSgtsa() {
29 }
30
31 public SegmentoSisAtribSgtsa(SegmentoSisAtribSgtsaPK comp_id) {
32 this.comp_id = comp_id;
33 }
34
35 public SegmentoSisAtribSgtsa(SegmentoSisAtribSgtsaPK comp_id, SegmentoItemSgti SegmentoItemSgti, SisAtributoSatb SisAtributoSatb) {
36 this.comp_id = comp_id;
37 this.SegmentoItemSgti = SegmentoItemSgti;
38 this.SisAtributoSatb = SisAtributoSatb;
39 }
40
41 @EmbeddedId
42 @AttributeOverrides( { @AttributeOverride(name = "codSgti", column = @Column(name = "COD_SGTI", nullable = false, length = 10)), @AttributeOverride(name = "codSatb", column = @Column(name = "COD_SATB", nullable = false, length = 10)) })
43 public SegmentoSisAtribSgtsaPK getComp_id() {
44 return this.comp_id;
45 }
46
47 public void setComp_id(SegmentoSisAtribSgtsaPK comp_id) {
48 this.comp_id = comp_id;
49 }
50
51 @ManyToOne(fetch = FetchType.LAZY)
52 @JoinColumn(name = "COD_SGTI", insertable = false, updatable = false)
53 public SegmentoItemSgti getSegmentoItemSgti() {
54 return this.SegmentoItemSgti;
55 }
56
57 public void setSegmentoItemSgti(SegmentoItemSgti SegmentoItemSgti) {
58 this.SegmentoItemSgti = SegmentoItemSgti;
59 }
60
61 @ManyToOne(fetch = FetchType.LAZY)
62 @JoinColumn(name = "COD_SATB", insertable = false, updatable = false)
63 public SisAtributoSatb getSisAtributoSatb() {
64 return this.SisAtributoSatb;
65 }
66
67 public void setSisAtributoSatb(SisAtributoSatb SisAtributoSatb) {
68 this.SisAtributoSatb = SisAtributoSatb;
69 }
70
71 public void atribuirPKPai() {
72 comp_id = new SegmentoSisAtribSgtsaPK();
73 comp_id.setCodSatb(this.getSisAtributoSatb().getCodSatb());
74 comp_id.setCodSgti(this.getSegmentoItemSgti().getCodSgti());
75 }
76
77 }