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 address details
20
 * 
21
 * @author ashikali
22
 *
23
 */
24
@Entity
21665 amit.gupta 25
@Table(name="user.address", schema = "user", uniqueConstraints = {@UniqueConstraint(columnNames = {"name", "line_1", "line_2", "landmark", "city", "state", "pin", "country", "phone"})})
21545 ashik.ali 26
@NamedQueries({
27
	@NamedQuery(name = "Address.selectCount", query = "select count(a) from Address a"),
28
	@NamedQuery(name="Address.selectAll",query="select a from Address a"),
29
	@NamedQuery(name="Address.selectById",query="select a from Address a where a.id= :id"),
30
	@NamedQuery(name="Address.selectByIds",query="select a from Address a where a.id in :ids"),
31
	@NamedQuery(name="Address.selectByParams",query="select a from Address a where a.name= :name and a.line1 = :line1 and a.line2 = :line2 and a.landmark = :landmark and a.city = :city and a.state = :state and a.pinCode = :pinCode and a.country = :country and a.phoneNumber = :phoneNumber"),
32
	@NamedQuery(name="Address.deleteById",query="delete from Address a where a.id= :id"),
33
})
34
public class Address implements Serializable{
35
 
36
	private static final long serialVersionUID = 1L;
37
 
38
	public Address() {
39
	}
40
 
41
	@Id
42
	@Column(name="id", unique=true, updatable=false)
43
	@GeneratedValue(strategy = GenerationType.IDENTITY)
44
	private int id;
45
 
46
	@Column(name="name")
47
	private String name;
48
 
49
	@Column(name = "line_1")
50
	private String line1;
51
 
52
	@Column(name = "line_2")
53
	private String line2;
54
 
55
	@Column(name = "landmark")
56
	private String landmark;
57
 
58
	@Column(name = "city")
59
	private String city;
60
 
61
	@Column(name = "state")
62
	private String state;
63
 
64
	@Column(name = "pin", length = 10)
65
	private String pinCode;
66
 
67
	@Column(name = "country", length = 100)
68
	private String country;
69
 
70
	@Column(name = "phone", length = 20)
71
	private String phoneNumber;
72
 
73
	@Column(name = "enabled", columnDefinition="tinyint(1) default 0")
74
	private boolean enabled;
75
 
76
	@Column(name="added_on", updatable = false)
77
	private LocalDateTime createTimestamp = LocalDateTime.now();
78
 
79
	@Column(name="update_timestamp")
80
	private LocalDateTime updateTimestamp = LocalDateTime.now();
81
 
82
	@Basic(optional = false)
83
    @Column(nullable = false)
84
	@Version
85
	private int version;
86
 
87
	public int getId() {
88
		return id;
89
	}
90
	public void setId(int id) {
91
		this.id = id;
92
	}
93
	public void setName(String name) {
94
        this.name = name;
95
    }
96
    public String getName() {
97
        return name;
98
    }
99
    public void setLine1(String line1) {
100
		this.line1 = line1;
101
	}
102
    public String getLine1() {
103
		return line1;
104
	}
105
    public void setLine2(String line2) {
106
		this.line2 = line2;
107
	}
108
    public String getLine2() {
109
		return line2;
110
	}
111
    public void setLandmark(String landmark) {
112
		this.landmark = landmark;
113
	}
114
    public String getLandmark() {
115
		return landmark;
116
	}
117
    public void setCity(String city) {
118
		this.city = city;
119
	}
120
    public String getCity() {
121
		return city;
122
	}
123
    public void setPinCode(String pinCode) {
124
		this.pinCode = pinCode;
125
	}
126
    public String getPinCode() {
127
		return pinCode;
128
	}
129
    public void setState(String state) {
130
		this.state = state;
131
	}
132
    public String getState() {
133
		return state;
134
	}
135
    public void setCountry(String country) {
136
		this.country = country;
137
	}
138
    public String getCountry() {
139
		return country;
140
	}
141
    public void setPhoneNumber(String phoneNumber) {
142
		this.phoneNumber = phoneNumber;
143
	}
144
    public String getPhoneNumber() {
145
		return phoneNumber;
146
	}
147
    public void setEnabled(boolean enabled) {
148
		this.enabled = enabled;
149
	}
150
    public boolean isEnabled() {
151
		return enabled;
152
	}
153
 
154
    public void setCreateTimestamp(LocalDateTime createTimestamp) {
155
		this.createTimestamp = createTimestamp;
156
	}
157
    public LocalDateTime getCreateTimestamp() {
158
		return createTimestamp;
159
	}
160
 
161
    public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
162
		this.updateTimestamp = updateTimestamp;
163
	}
164
    public LocalDateTime getUpdateTimestamp() {
165
		return updateTimestamp;
166
	}
167
 
168
    public void setVersion(int version) {
169
		this.version = version;
170
	}
171
    public int getVersion() {
172
		return version;
173
	}
174
 
175
	@Override
176
	public String toString() {
177
		return "Address [id=" + id + ", name=" + name + ", line1=" + line1 + ", line2=" + line2 + ", landmark="
178
				+ landmark + ", city=" + city + ", state=" + state + ", pinCode=" + pinCode + ", country=" + country
179
				+ ", phoneNumber=" + phoneNumber + ", enabled=" + enabled + ", createTimestamp=" + createTimestamp
21602 ashik.ali 180
				+ ", updateTimestamp=" + updateTimestamp + "]";
21545 ashik.ali 181
	}
182
 
183
 
184
}