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 | 0 | @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 | 0 | public CategoryVO() { |
53 | 0 | } |
54 | |
|
55 | |
@Deprecated |
56 | 0 | public CategoryVO(Integer categoriaID) { |
57 | 0 | this.categoriaID = categoriaID; |
58 | 0 | } |
59 | |
|
60 | |
@Deprecated |
61 | |
public CategoryVO(Integer categoriaID, String nmcategoria) { |
62 | 0 | this(categoriaID); |
63 | 0 | this.nmcategoria = nmcategoria; |
64 | 0 | } |
65 | |
|
66 | 0 | public CategoryVO(String nmcategoria) { |
67 | 0 | this.nmcategoria = nmcategoria; |
68 | 0 | } |
69 | |
|
70 | |
public CategoryVO(String nmcategoria, CategoryVO categoriaPai) { |
71 | 0 | this(nmcategoria); |
72 | 0 | this.categoriaPai = categoriaPai; |
73 | 0 | } |
74 | |
|
75 | |
public Integer getCategoriaID() { |
76 | 0 | return categoriaID; |
77 | |
} |
78 | |
|
79 | |
public void setCategoriaID(Integer categoriaid) { |
80 | 0 | this.categoriaID = categoriaid; |
81 | 0 | } |
82 | |
|
83 | |
public String getNmcategoria() { |
84 | 0 | return nmcategoria; |
85 | |
} |
86 | |
|
87 | |
public void setNmcategoria(String nmcategoria) { |
88 | 0 | this.nmcategoria = nmcategoria; |
89 | 0 | } |
90 | |
|
91 | |
|
92 | |
|
93 | |
|
94 | |
public CategoryVO getCategoriaPai() { |
95 | 0 | return categoriaPai; |
96 | |
} |
97 | |
|
98 | |
|
99 | |
|
100 | |
|
101 | |
public void setCategoriaPai(CategoryVO categoriaPai) { |
102 | 0 | this.categoriaPai = categoriaPai; |
103 | 0 | } |
104 | |
|
105 | |
@Override |
106 | |
public int hashCode() { |
107 | 0 | int hash = 0; |
108 | 0 | hash += (categoriaID != null ? categoriaID.hashCode() : 0); |
109 | 0 | return hash; |
110 | |
} |
111 | |
|
112 | |
@Override |
113 | |
public boolean equals(Object object) { |
114 | |
|
115 | 0 | if (!(object instanceof CategoryVO)) { |
116 | 0 | return false; |
117 | |
} |
118 | 0 | CategoryVO other = (CategoryVO) object; |
119 | 0 | if ((this.categoriaID == null && other.categoriaID != null) || (this.categoriaID != null && !this.categoriaID.equals(other.categoriaID))) { |
120 | 0 | return false; |
121 | |
} |
122 | 0 | return true; |
123 | |
} |
124 | |
|
125 | |
@Override |
126 | |
public String toString() { |
127 | 0 | return this.getClass().getCanonicalName() + "[categoriaid=" + categoriaID + "]"; |
128 | |
} |
129 | |
|
130 | |
@Override |
131 | |
public Integer getId() { |
132 | 0 | return categoriaID; |
133 | |
} |
134 | |
} |