Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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