package com.jetbrains.persistence.models;
import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import java.util.Collection;
@Entity
public class Customer {
private int id;
@javax.persistence.Column(name = "id")
@Id
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
private String firstName;
@javax.persistence.Column(name = "first_name")
@Basic
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
private String middleName;
@javax.persistence.Column(name = "middle_name")
@Basic
public String getMiddleName() {
return middleName;
}
public void setMiddleName(String middleName) {
this.middleName = middleName;
}
private String lastName;
@javax.persistence.Column(name = "last_name")
@Basic
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
private String phone;
@javax.persistence.Column(name = "phone")
@Basic
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
private String email;
@javax.persistence.Column(name = "email")
@Basic
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
private String notes;
@javax.persistence.Column(name = "notes")
@Basic
public String getNotes() {
return notes;
}
public void setNotes(String notes) {
this.notes = notes;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Customer customer = (Customer) o;
if (id != customer.id) return false;
if (email != null ? !email.equals(customer.email) : customer.email != null) return false;
if (firstName != null ? !firstName.equals(customer.firstName) : customer.firstName != null) return false;
if (lastName != null ? !lastName.equals(customer.lastName) : customer.lastName != null) return false;
if (middleName != null ? !middleName.equals(customer.middleName) : customer.middleName != null) return false;
if (notes != null ? !notes.equals(customer.notes) : customer.notes != null) return false;
if (phone != null ? !phone.equals(customer.phone) : customer.phone != null) return false;
return true;
}
@Override
public int hashCode() {
int result = id;
result = 31 * result + (firstName != null ? firstName.hashCode() : 0);
result = 31 * result + (middleName != null ? middleName.hashCode() : 0);
result = 31 * result + (lastName != null ? lastName.hashCode() : 0);
result = 31 * result + (phone != null ? phone.hashCode() : 0);
result = 31 * result + (email != null ? email.hashCode() : 0);
result = 31 * result + (notes != null ? notes.hashCode() : 0);
return result;
}
private Collection<Order> ordersById;
@OneToMany(mappedBy = "customerByCustomerId")
public Collection<Order> getOrdersById() {
return ordersById;
}
public void setOrdersById(Collection<Order> ordersById) {
this.ordersById = ordersById;
}
}