Rev 21924 | Rev 22009 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
package com.spice.profitmandi.dao.entity.fofo;import java.io.Serializable;import java.time.LocalDateTime;import java.util.List;import javax.persistence.CascadeType;import javax.persistence.Column;import javax.persistence.Entity;import javax.persistence.FetchType;import javax.persistence.GeneratedValue;import javax.persistence.GenerationType;import javax.persistence.Id;import javax.persistence.JoinColumn;import javax.persistence.ManyToOne;import javax.persistence.NamedQueries;import javax.persistence.NamedQuery;import javax.persistence.OneToMany;import javax.persistence.Table;/*** This class basically contains details** @author ashikali**/@Entity@Table(name="fofo.customer", schema = "fofo")@NamedQueries({@NamedQuery(name="Customer.selectById",query="select c from Customer c where c.id= :id")})public class Customer implements Serializable{private static final long serialVersionUID = 1L;public Customer() {}@Id@Column(name="id")@GeneratedValue(strategy = GenerationType.IDENTITY)private int id;@Column(name = "name", length = 100)private String name;@Column(name="email_id", length = 20)private String emailId;@Column(name="mobile_number", length = 20)private String mobileNumber;@Column(name = "create_timestamp")private LocalDateTime createTimestamp = LocalDateTime.now();@Overridepublic int hashCode() {final int prime = 31;int result = 1;result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());result = prime * result + ((customerAddress == null) ? 0 : customerAddress.hashCode());result = prime * result + ((emailId == null) ? 0 : emailId.hashCode());result = prime * result + id;result = prime * result + ((mobileNumber == null) ? 0 : mobileNumber.hashCode());result = prime * result + ((name == null) ? 0 : name.hashCode());return result;}@Overridepublic boolean equals(Object obj) {if (this == obj)return true;if (obj == null)return false;if (getClass() != obj.getClass())return false;Customer other = (Customer) obj;if (createTimestamp == null) {if (other.createTimestamp != null)return false;} else if (!createTimestamp.equals(other.createTimestamp))return false;if (customerAddress == null) {if (other.customerAddress != null)return false;} else if (!customerAddress.equals(other.customerAddress))return false;if (emailId == null) {if (other.emailId != null)return false;} else if (!emailId.equals(other.emailId))return false;if (id != other.id)return false;if (mobileNumber == null) {if (other.mobileNumber != null)return false;} else if (!mobileNumber.equals(other.mobileNumber))return false;if (name == null) {if (other.name != null)return false;} else if (!name.equals(other.name))return false;return true;}@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY)@JoinColumn(name="customer_id",insertable=false,updatable=false,nullable=false)private List<CustomerAddress> customerAddress;public List<CustomerAddress> getCustomerAddress() {return customerAddress;}public void setCustomerAddress(List<CustomerAddress> customerAddress) {this.customerAddress = customerAddress;}public int getId() {return id;}public void setId(int id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getEmailId() {return emailId;}public void setEmailId(String emailId) {this.emailId = emailId;}public String getMobileNumber() {return mobileNumber;}public void setMobileNumber(String mobileNumber) {this.mobileNumber = mobileNumber;}@Overridepublic String toString() {return "Customer [id=" + id + ", name=" + name + ", emailId=" + emailId + ", mobileNumber=" + mobileNumber+ ", createTimestamp=" + createTimestamp + ", customerAddress=" + customerAddress + "]";}}