Subversion Repositories SmartDukaan

Rev

Rev 26774 | Rev 26778 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
21714 ashik.ali 1
package com.spice.profitmandi.dao.entity.fofo;
21602 ashik.ali 2
 
3
import java.io.Serializable;
4
import java.time.LocalDateTime;
21984 kshitij.so 5
import java.util.List;
21602 ashik.ali 6
 
21984 kshitij.so 7
import javax.persistence.CascadeType;
21602 ashik.ali 8
import javax.persistence.Column;
22009 ashik.ali 9
import javax.persistence.Convert;
21602 ashik.ali 10
import javax.persistence.Entity;
21984 kshitij.so 11
import javax.persistence.FetchType;
21602 ashik.ali 12
import javax.persistence.GeneratedValue;
13
import javax.persistence.GenerationType;
14
import javax.persistence.Id;
21984 kshitij.so 15
import javax.persistence.JoinColumn;
21602 ashik.ali 16
import javax.persistence.NamedQueries;
17
import javax.persistence.NamedQuery;
21984 kshitij.so 18
import javax.persistence.OneToMany;
21602 ashik.ali 19
import javax.persistence.Table;
20
 
26774 amit.gupta 21
import com.fasterxml.jackson.annotation.JsonIgnore;
22009 ashik.ali 22
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
23
 
21602 ashik.ali 24
/**
21653 ashik.ali 25
 * This class basically contains  details
21602 ashik.ali 26
 * 
27
 * @author ashikali
28
 *
29
 */
30
@Entity
31
@Table(name="fofo.customer", schema = "fofo")
32
@NamedQueries({
33
	@NamedQuery(name="Customer.selectById",query="select c from Customer c where c.id= :id")
34
})
35
public class Customer implements Serializable{
36
 
37
	private static final long serialVersionUID = 1L;
38
 
39
	public Customer() {
40
	}
41
 
42
	@Id
43
	@Column(name="id")
44
	@GeneratedValue(strategy = GenerationType.IDENTITY)
45
	private int id;
46
 
22216 ashik.ali 47
	@Column(name = "first_name", length = 20)
48
	private String firstName;
21687 ashik.ali 49
 
22216 ashik.ali 50
	@Column(name = "last_name", length = 20)
51
	private String lastName;
52
 
21602 ashik.ali 53
	@Column(name="email_id", length = 20)
54
	private String emailId;
55
 
56
	@Column(name="mobile_number", length = 20)
57
	private String mobileNumber;
58
 
26774 amit.gupta 59
	@Column(name="password")
60
	@JsonIgnore
61
	private String password;
62
 
63
 
64
 
65
	public String getPassword() {
66
		return password;
67
	}
68
	public void setPassword(String password) {
69
		this.password = password;
70
	}
71
	public LocalDateTime getCreateTimestamp() {
72
		return createTimestamp;
73
	}
74
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
75
		this.createTimestamp = createTimestamp;
76
	}
77
 
22009 ashik.ali 78
	@Convert(converter = LocalDateTimeAttributeConverter.class)
21677 ashik.ali 79
	@Column(name = "create_timestamp")
21602 ashik.ali 80
	private LocalDateTime createTimestamp = LocalDateTime.now();
21984 kshitij.so 81
 
82
	@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY)
83
	@JoinColumn(name="customer_id",insertable=false,updatable=false,nullable=false)
26776 amit.gupta 84
	@JsonIgnore
21984 kshitij.so 85
	private List<CustomerAddress> customerAddress;	
86
 
87
	public List<CustomerAddress> getCustomerAddress() {
88
		return customerAddress;
89
	}
90
	public void setCustomerAddress(List<CustomerAddress> customerAddress) {
91
		this.customerAddress = customerAddress;
92
	}
93
	public int getId() {
94
		return id;
95
	}
96
	public void setId(int id) {
97
		this.id = id;
98
	}
99
 
22216 ashik.ali 100
	public String getFirstName() {
101
		return firstName;
21984 kshitij.so 102
	}
22216 ashik.ali 103
	public void setFirstName(String firstName) {
104
		this.firstName = firstName;
21984 kshitij.so 105
	}
106
 
22216 ashik.ali 107
	public String getLastName() {
108
		return lastName;
109
	}
110
	public void setLastName(String lastName) {
111
		this.lastName = lastName;
112
	}
113
 
21984 kshitij.so 114
	public String getEmailId() {
115
		return emailId;
116
	}
117
	public void setEmailId(String emailId) {
118
		this.emailId = emailId;
119
	}
120
 
121
	public String getMobileNumber() {
122
		return mobileNumber;
123
	}
124
	public void setMobileNumber(String mobileNumber) {
125
		this.mobileNumber = mobileNumber;
126
	}
127
 
22009 ashik.ali 128
 
129
 
21924 ashik.ali 130
	@Override
22009 ashik.ali 131
	public int hashCode() {
132
		final int prime = 31;
133
		int result = 1;
134
		result = prime * result + id;
135
		return result;
136
	}
137
	@Override
138
	public boolean equals(Object obj) {
139
		if (this == obj)
140
			return true;
141
		if (obj == null)
142
			return false;
143
		if (getClass() != obj.getClass())
144
			return false;
145
		Customer other = (Customer) obj;
146
		if (id != other.id)
147
			return false;
148
		return true;
149
	}
150
	@Override
21602 ashik.ali 151
	public String toString() {
22243 ashik.ali 152
		return "Customer [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", emailId=" + emailId 
153
				+ ", mobileNumber=" + mobileNumber + ", createTimestamp=" + createTimestamp + ", customerAddress=" 
154
				+ customerAddress + "]";
21602 ashik.ali 155
	}
156
 
22216 ashik.ali 157
 
21602 ashik.ali 158
}