Subversion Repositories SmartDukaan

Rev

Rev 21720 | Rev 22009 | 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;
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
import javax.persistence.UniqueConstraint;
15
 
16
/**
17
 * This class basically contains api details
18
 * 
19
 * @author ashikali
20
 *
21
 */
22
@Entity
21720 ashik.ali 23
@Table(name="dtr.shop", schema = "dtr", uniqueConstraints = {@UniqueConstraint(columnNames = {"name","retailer_id", "document_id", "address_id"})})
21545 ashik.ali 24
@NamedQueries({
25
	@NamedQuery(name = "Shop.selectCount", query = "select count(s) from Shop s"),
26
	@NamedQuery(name="Shop.selectAll",query="select s from Shop s"),
27
	@NamedQuery(name="Shop.selectById",query="select s from Shop s where s.id= :id"),
28
	@NamedQuery(name="Shop.selectByName",query="select s from Shop s where s.name= :name"),
29
	@NamedQuery(name="Shop.selectByRetailerId",query="select s from Shop s where s.retailerId= :retailerId"),
30
	@NamedQuery(name="Shop.selectByDocumentId",query="select s from Shop s where s.documentId= :documentId"),
31
	@NamedQuery(name = "Shop.selectCountByDocumentId", query = "select count(s) from Shop s where s.documentId= :documentId"),
32
	@NamedQuery(name="Shop.deleteById",query="delete from Shop s where s.id= :id"),
33
	@NamedQuery(name="Shop.deleteByShopAndRetailerId",query="delete from Shop s where s.id= :id and s.retailerId = :retailerId")
34
})
35
public class Shop implements Serializable{
36
 
37
	private static final long serialVersionUID = 1L;
38
 
39
	public Shop() {
40
	}
41
 
42
	@Id
43
	@Column(name="id", unique=true, updatable=false)
44
	@GeneratedValue(strategy = GenerationType.IDENTITY)
45
	private int id;
46
 
47
	@Column(name="name")
48
	private String name;
49
 
50
	@Column(name = "retailer_id")
51
	private int retailerId;
52
 
53
	@Column(name = "document_id")
54
	private int documentId;
55
 
56
	@Column(name = "address_id")
57
	private int addressId;
58
 
59
	@Column(name="create_timestamp", updatable = false)
60
	private LocalDateTime createTimestamp = LocalDateTime.now();
61
 
62
	@Column(name="update_timestamp")
63
	private LocalDateTime updateTimestamp = LocalDateTime.now();
64
 
65
	public int getId() {
66
		return id;
67
	}
68
	public void setId(int id) {
69
		this.id = id;
70
	}
71
	public void setName(String name) {
72
        this.name = name;
73
    }
74
    public String getName() {
75
        return name;
76
    }
77
 
78
    public int getRetailerId() {
79
		return retailerId;
80
	}
81
    public void setRetailerId(int retailerId) {
82
		this.retailerId = retailerId;
83
	}
84
 
85
    public int getDocumentId() {
86
		return documentId;
87
	}
88
    public void setDocumentId(int documentId) {
89
		this.documentId = documentId;
90
	}
91
    public void setAddressId(int addressId) {
92
		this.addressId = addressId;
93
	}
94
    public int getAddressId() {
95
		return addressId;
96
	}
97
 
98
    public void setCreateTimestamp(LocalDateTime createTimestamp) {
99
		this.createTimestamp = createTimestamp;
100
	}
101
    public LocalDateTime getCreateTimestamp() {
102
		return createTimestamp;
103
	}
104
 
105
    public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
106
		this.updateTimestamp = updateTimestamp;
107
	}
108
    public LocalDateTime getUpdateTimestamp() {
109
		return updateTimestamp;
110
	}
111
 
21924 ashik.ali 112
 
21602 ashik.ali 113
	@Override
21924 ashik.ali 114
	public int hashCode() {
115
		final int prime = 31;
116
		int result = 1;
117
		result = prime * result + addressId;
118
		result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
119
		result = prime * result + documentId;
120
		result = prime * result + id;
121
		result = prime * result + ((name == null) ? 0 : name.hashCode());
122
		result = prime * result + retailerId;
123
		result = prime * result + ((updateTimestamp == null) ? 0 : updateTimestamp.hashCode());
124
		return result;
125
	}
126
	@Override
127
	public boolean equals(Object obj) {
128
		if (this == obj)
129
			return true;
130
		if (obj == null)
131
			return false;
132
		if (getClass() != obj.getClass())
133
			return false;
134
		Shop other = (Shop) obj;
135
		if (addressId != other.addressId)
136
			return false;
137
		if (createTimestamp == null) {
138
			if (other.createTimestamp != null)
139
				return false;
140
		} else if (!createTimestamp.equals(other.createTimestamp))
141
			return false;
142
		if (documentId != other.documentId)
143
			return false;
144
		if (id != other.id)
145
			return false;
146
		if (name == null) {
147
			if (other.name != null)
148
				return false;
149
		} else if (!name.equals(other.name))
150
			return false;
151
		if (retailerId != other.retailerId)
152
			return false;
153
		if (updateTimestamp == null) {
154
			if (other.updateTimestamp != null)
155
				return false;
156
		} else if (!updateTimestamp.equals(other.updateTimestamp))
157
			return false;
158
		return true;
159
	}
160
	@Override
21602 ashik.ali 161
	public String toString() {
162
		return "Shop [id=" + id + ", name=" + name + ", retailerId=" + retailerId + ", documentId=" + documentId
163
				+ ", addressId=" + addressId + ", createTimestamp=" + createTimestamp + ", updateTimestamp="
21693 ashik.ali 164
				+ updateTimestamp + "]";
21602 ashik.ali 165
	}
166
 
167
 
21545 ashik.ali 168
 
169
}