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
	public int getId() {
68
		return id;
69
	}
70
	public void setId(int id) {
71
		this.id = id;
72
	}
73
	public void setName(String name) {
74
        this.name = name;
75
    }
76
    public String getName() {
77
        return name;
78
    }
79
 
80
    public int getRetailerId() {
81
		return retailerId;
82
	}
83
    public void setRetailerId(int retailerId) {
84
		this.retailerId = retailerId;
85
	}
86
 
87
    public int getDocumentId() {
88
		return documentId;
89
	}
90
    public void setDocumentId(int documentId) {
91
		this.documentId = documentId;
92
	}
93
    public void setAddressId(int addressId) {
94
		this.addressId = addressId;
95
	}
96
    public int getAddressId() {
97
		return addressId;
98
	}
99
 
100
    public void setCreateTimestamp(LocalDateTime createTimestamp) {
101
		this.createTimestamp = createTimestamp;
102
	}
103
    public LocalDateTime getCreateTimestamp() {
104
		return createTimestamp;
105
	}
106
 
107
    public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
108
		this.updateTimestamp = updateTimestamp;
109
	}
110
    public LocalDateTime getUpdateTimestamp() {
111
		return updateTimestamp;
112
	}
113
 
21602 ashik.ali 114
	@Override
115
	public String toString() {
116
		return "Shop [id=" + id + ", name=" + name + ", retailerId=" + retailerId + ", documentId=" + documentId
117
				+ ", addressId=" + addressId + ", createTimestamp=" + createTimestamp + ", updateTimestamp="
21693 ashik.ali 118
				+ updateTimestamp + "]";
21602 ashik.ali 119
	}
120
 
121
 
21545 ashik.ali 122
 
123
}