package com.mycompany.entity; import javax.persistence.*; import java.sql.Timestamp; /** * Created by ziqew on 12/5/13. */ @Entity @Table(name = "products") public class Product { private int id; private String title; private String description; private String imageUrl; private Integer price; private Timestamp createdAt; private Timestamp updatedAt; @Id @Column(name = "id") @GeneratedValue(strategy = GenerationType.AUTO) public int getId() { return id; } public void setId(int id) { this.id = id; } @Basic @Column(name = "title") public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } @Basic @Column(name = "description") public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } @Basic @Column(name = "image_url") public String getImageUrl() { return imageUrl; } public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; } @Basic @Column(name = "price") public Integer getPrice() { return price; } public void setPrice(Integer price) { this.price = price; } @Basic @Column(name = "created_at") public Timestamp getCreatedAt() { return createdAt; } public void setCreatedAt(Timestamp createdAt) { this.createdAt = createdAt; } @Basic @Column(name = "updated_at") public Timestamp getUpdatedAt() { return updatedAt; } public void setUpdatedAt(Timestamp updatedAt) { this.updatedAt = updatedAt; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Product product = (Product) o; if (id != product.id) return false; if (createdAt != null ? !createdAt.equals(product.createdAt) : product.createdAt != null) return false; if (description != null ? !description.equals(product.description) : product.description != null) return false; if (imageUrl != null ? !imageUrl.equals(product.imageUrl) : product.imageUrl != null) return false; if (price != null ? !price.equals(product.price) : product.price != null) return false; if (title != null ? !title.equals(product.title) : product.title != null) return false; if (updatedAt != null ? !updatedAt.equals(product.updatedAt) : product.updatedAt != null) return false; return true; } @Override public int hashCode() { int result = id; result = 31 * result + (title != null ? title.hashCode() : 0); result = 31 * result + (description != null ? description.hashCode() : 0); result = 31 * result + (imageUrl != null ? imageUrl.hashCode() : 0); result = 31 * result + (price != null ? price.hashCode() : 0); result = 31 * result + (createdAt != null ? createdAt.hashCode() : 0); result = 31 * result + (updatedAt != null ? updatedAt.hashCode() : 0); return result; } }