Subversion Repositories SmartDukaan

Rev

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