Subversion Repositories SmartDukaan

Rev

Rev 22243 | Rev 26776 | 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)
84
	private List<CustomerAddress> customerAddress;	
85
 
86
	public List<CustomerAddress> getCustomerAddress() {
87
		return customerAddress;
88
	}
89
	public void setCustomerAddress(List<CustomerAddress> customerAddress) {
90
		this.customerAddress = customerAddress;
91
	}
92
	public int getId() {
93
		return id;
94
	}
95
	public void setId(int id) {
96
		this.id = id;
97
	}
98
 
22216 ashik.ali 99
	public String getFirstName() {
100
		return firstName;
21984 kshitij.so 101
	}
22216 ashik.ali 102
	public void setFirstName(String firstName) {
103
		this.firstName = firstName;
21984 kshitij.so 104
	}
105
 
22216 ashik.ali 106
	public String getLastName() {
107
		return lastName;
108
	}
109
	public void setLastName(String lastName) {
110
		this.lastName = lastName;
111
	}
112
 
21984 kshitij.so 113
	public String getEmailId() {
114
		return emailId;
115
	}
116
	public void setEmailId(String emailId) {
117
		this.emailId = emailId;
118
	}
119
 
120
	public String getMobileNumber() {
121
		return mobileNumber;
122
	}
123
	public void setMobileNumber(String mobileNumber) {
124
		this.mobileNumber = mobileNumber;
125
	}
126
 
22009 ashik.ali 127
 
128
 
21924 ashik.ali 129
	@Override
22009 ashik.ali 130
	public int hashCode() {
131
		final int prime = 31;
132
		int result = 1;
133
		result = prime * result + id;
134
		return result;
135
	}
136
	@Override
137
	public boolean equals(Object obj) {
138
		if (this == obj)
139
			return true;
140
		if (obj == null)
141
			return false;
142
		if (getClass() != obj.getClass())
143
			return false;
144
		Customer other = (Customer) obj;
145
		if (id != other.id)
146
			return false;
147
		return true;
148
	}
149
	@Override
21602 ashik.ali 150
	public String toString() {
22243 ashik.ali 151
		return "Customer [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", emailId=" + emailId 
152
				+ ", mobileNumber=" + mobileNumber + ", createTimestamp=" + createTimestamp + ", customerAddress=" 
153
				+ customerAddress + "]";
21602 ashik.ali 154
	}
155
 
22216 ashik.ali 156
 
21602 ashik.ali 157
}