Subversion Repositories SmartDukaan

Rev

Rev 21924 | Rev 23269 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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