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 Vendor {
private int id;
@javax.persistence.Column(name = "id")
@Id
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
private String name;
@javax.persistence.Column(name = "name")
@Basic
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
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;
Vendor vendor = (Vendor) o;
if (id != vendor.id) return false;
if (email != null ? !email.equals(vendor.email) : vendor.email != null) return false;
if (name != null ? !name.equals(vendor.name) : vendor.name != null) return false;
if (notes != null ? !notes.equals(vendor.notes) : vendor.notes != null) return false;
if (phone != null ? !phone.equals(vendor.phone) : vendor.phone != null) return false;
return true;
}
@Override
public int hashCode() {
int result = id;
result = 31 * result + (name != null ? name.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<Product> productsById;
@OneToMany(mappedBy = "vendorByVendorId")
public Collection<Product> getProductsById() {
return productsById;
}
public void setProductsById(Collection<Product> productsById) {
this.productsById = productsById;
}
}