1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package net.sf.webphotos.model;
21
22 import java.io.Serializable;
23 import javax.persistence.*;
24 import net.sf.webphotos.entity.HasID;
25
26
27
28
29
30 @Entity
31 @Table(name = "CATEGORIAS")
32 @NamedQueries({
33 @NamedQuery(name = "CategoryVO.findByCategoriaID", query = "SELECT c FROM CategoryVO c WHERE c.categoriaID = :categoriaID"),
34 @NamedQuery(name = "CategoryVO.findByNmcategoria", query = "SELECT c FROM CategoryVO c WHERE c.nmcategoria = :nmcategoria")})
35 public class CategoryVO implements Serializable, HasID<Integer> {
36
37 private static final long serialVersionUID = 1L;
38
39 @Id
40 @Column(name = "CATEGORIAID", nullable = false)
41 @GeneratedValue(strategy=GenerationType.IDENTITY)
42 private Integer categoriaID;
43
44 @Column(name = "NMCATEGORIA", nullable = false)
45 private String nmcategoria;
46
47 @ManyToOne(optional = true)
48 @JoinColumn(name = "CATEGORIAPAI")
49 private CategoryVO categoriaPai;
50
51 @Deprecated
52 public CategoryVO() {
53 }
54
55 @Deprecated
56 public CategoryVO(Integer categoriaID) {
57 this.categoriaID = categoriaID;
58 }
59
60 @Deprecated
61 public CategoryVO(Integer categoriaID, String nmcategoria) {
62 this(categoriaID);
63 this.nmcategoria = nmcategoria;
64 }
65
66 public CategoryVO(String nmcategoria) {
67 this.nmcategoria = nmcategoria;
68 }
69
70 public CategoryVO(String nmcategoria, CategoryVO categoriaPai) {
71 this(nmcategoria);
72 this.categoriaPai = categoriaPai;
73 }
74
75 public Integer getCategoriaID() {
76 return categoriaID;
77 }
78
79 public void setCategoriaID(Integer categoriaid) {
80 this.categoriaID = categoriaid;
81 }
82
83 public String getNmcategoria() {
84 return nmcategoria;
85 }
86
87 public void setNmcategoria(String nmcategoria) {
88 this.nmcategoria = nmcategoria;
89 }
90
91
92
93
94 public CategoryVO getCategoriaPai() {
95 return categoriaPai;
96 }
97
98
99
100
101 public void setCategoriaPai(CategoryVO categoriaPai) {
102 this.categoriaPai = categoriaPai;
103 }
104
105 @Override
106 public int hashCode() {
107 int hash = 0;
108 hash += (categoriaID != null ? categoriaID.hashCode() : 0);
109 return hash;
110 }
111
112 @Override
113 public boolean equals(Object object) {
114
115 if (!(object instanceof CategoryVO)) {
116 return false;
117 }
118 CategoryVO other = (CategoryVO) object;
119 if ((this.categoriaID == null && other.categoriaID != null) || (this.categoriaID != null && !this.categoriaID.equals(other.categoriaID))) {
120 return false;
121 }
122 return true;
123 }
124
125 @Override
126 public String toString() {
127 return this.getClass().getCanonicalName() + "[categoriaid=" + categoriaID + "]";
128 }
129
130 @Override
131 public Integer getId() {
132 return categoriaID;
133 }
134 }