Subversion Repositories SmartDukaan

Rev

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