| 21720 |
ashik.ali |
1 |
package com.spice.profitmandi.dao.entity.dtr;
|
| 21545 |
ashik.ali |
2 |
|
|
|
3 |
import java.io.Serializable;
|
|
|
4 |
import java.time.LocalDateTime;
|
|
|
5 |
|
|
|
6 |
import javax.persistence.Column;
|
|
|
7 |
import javax.persistence.Entity;
|
|
|
8 |
import javax.persistence.GeneratedValue;
|
|
|
9 |
import javax.persistence.GenerationType;
|
|
|
10 |
import javax.persistence.Id;
|
|
|
11 |
import javax.persistence.NamedQueries;
|
|
|
12 |
import javax.persistence.NamedQuery;
|
|
|
13 |
import javax.persistence.Table;
|
|
|
14 |
|
|
|
15 |
/**
|
|
|
16 |
* This class basically contains api details
|
|
|
17 |
*
|
|
|
18 |
* @author ashikali
|
|
|
19 |
*
|
|
|
20 |
*/
|
|
|
21 |
@Entity
|
| 21596 |
ashik.ali |
22 |
@Table(name="dtr.brands", schema = "dtr")
|
| 21545 |
ashik.ali |
23 |
@NamedQueries({
|
|
|
24 |
@NamedQuery(name = "Brand.selectCount", query = "select count(b) from Brand b"),
|
|
|
25 |
@NamedQuery(name="Brand.selectAll",query="select b from Brand b where b.displayedInPreferencePage = :displayedInPreferencePage"),
|
|
|
26 |
@NamedQuery(name="Brand.selectById",query="select b from Brand b where b.id= :id"),
|
|
|
27 |
@NamedQuery(name="Brand.selectByName",query="select b from Brand b where b.name= :name"),
|
|
|
28 |
@NamedQuery(name="Brand.selectByIdAndName",query="select b from Brand b where b.id = :id and b.name= :name"),
|
|
|
29 |
@NamedQuery(name = "Brand.selectCountByName", query = "select count(b) from Brand b where b.name= :name"),
|
|
|
30 |
@NamedQuery(name="Brand.deleteById",query="delete from Brand b where b.id= :id")
|
|
|
31 |
})
|
|
|
32 |
public class Brand implements Serializable{
|
|
|
33 |
|
|
|
34 |
private static final long serialVersionUID = 1L;
|
|
|
35 |
|
|
|
36 |
public Brand() {
|
|
|
37 |
}
|
|
|
38 |
|
|
|
39 |
@Id
|
|
|
40 |
@Column(name="id", columnDefinition = "int(10) unsigned")
|
|
|
41 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
42 |
private int id;
|
|
|
43 |
|
|
|
44 |
@Column(name="name")
|
|
|
45 |
private String name;
|
|
|
46 |
|
|
|
47 |
@Column(name = "category_id")
|
|
|
48 |
private int categoryId;
|
|
|
49 |
|
|
|
50 |
@Column(name = "displayed_in_preference_page", columnDefinition="tinyint(1) default 0")
|
|
|
51 |
private boolean displayedInPreferencePage;
|
|
|
52 |
|
|
|
53 |
@Column(name = "created")
|
|
|
54 |
private LocalDateTime createTimestamp;
|
|
|
55 |
|
|
|
56 |
public int getId() {
|
|
|
57 |
return id;
|
|
|
58 |
}
|
|
|
59 |
public void setId(int id) {
|
|
|
60 |
this.id = id;
|
|
|
61 |
}
|
|
|
62 |
public void setName(String name) {
|
|
|
63 |
this.name = name;
|
|
|
64 |
}
|
|
|
65 |
public String getName() {
|
|
|
66 |
return name;
|
|
|
67 |
}
|
|
|
68 |
|
|
|
69 |
public int getCategoryId() {
|
|
|
70 |
return categoryId;
|
|
|
71 |
}
|
|
|
72 |
public void setCategoryId(int categoryId) {
|
|
|
73 |
this.categoryId = categoryId;
|
|
|
74 |
}
|
|
|
75 |
public boolean isDisplayedInPreferencePage() {
|
|
|
76 |
return displayedInPreferencePage;
|
|
|
77 |
}
|
|
|
78 |
public void setDisplayedInPreferencePage(boolean displayedInPreferencePage) {
|
|
|
79 |
this.displayedInPreferencePage = displayedInPreferencePage;
|
|
|
80 |
}
|
|
|
81 |
public LocalDateTime getCreateTimestamp() {
|
|
|
82 |
return createTimestamp;
|
|
|
83 |
}
|
|
|
84 |
public void setCreateTimestamp(LocalDateTime createTimestamp) {
|
|
|
85 |
this.createTimestamp = createTimestamp;
|
|
|
86 |
}
|
| 21924 |
ashik.ali |
87 |
|
| 21602 |
ashik.ali |
88 |
@Override
|
| 21924 |
ashik.ali |
89 |
public int hashCode() {
|
|
|
90 |
final int prime = 31;
|
|
|
91 |
int result = 1;
|
|
|
92 |
result = prime * result + categoryId;
|
|
|
93 |
result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
|
|
|
94 |
result = prime * result + (displayedInPreferencePage ? 1231 : 1237);
|
|
|
95 |
result = prime * result + id;
|
|
|
96 |
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
|
|
97 |
return result;
|
|
|
98 |
}
|
|
|
99 |
@Override
|
|
|
100 |
public boolean equals(Object obj) {
|
|
|
101 |
if (this == obj)
|
|
|
102 |
return true;
|
|
|
103 |
if (obj == null)
|
|
|
104 |
return false;
|
|
|
105 |
if (getClass() != obj.getClass())
|
|
|
106 |
return false;
|
|
|
107 |
Brand other = (Brand) obj;
|
|
|
108 |
if (categoryId != other.categoryId)
|
|
|
109 |
return false;
|
|
|
110 |
if (createTimestamp == null) {
|
|
|
111 |
if (other.createTimestamp != null)
|
|
|
112 |
return false;
|
|
|
113 |
} else if (!createTimestamp.equals(other.createTimestamp))
|
|
|
114 |
return false;
|
|
|
115 |
if (displayedInPreferencePage != other.displayedInPreferencePage)
|
|
|
116 |
return false;
|
|
|
117 |
if (id != other.id)
|
|
|
118 |
return false;
|
|
|
119 |
if (name == null) {
|
|
|
120 |
if (other.name != null)
|
|
|
121 |
return false;
|
|
|
122 |
} else if (!name.equals(other.name))
|
|
|
123 |
return false;
|
|
|
124 |
return true;
|
|
|
125 |
}
|
|
|
126 |
@Override
|
| 21602 |
ashik.ali |
127 |
public String toString() {
|
|
|
128 |
return "Brand [id=" + id + ", name=" + name + ", categoryId=" + categoryId + ", displayedInPreferencePage="
|
|
|
129 |
+ displayedInPreferencePage + ", createTimestamp=" + createTimestamp + "]";
|
|
|
130 |
}
|
| 21545 |
ashik.ali |
131 |
|
|
|
132 |
|
|
|
133 |
}
|