Guest User

Untitled

a guest
Jan 4th, 2017
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.56 KB | None | 0 0
  1. @Entity
  2. public class Category implements Serializable {
  3.  
  4.     @TableGenerator(
  5.             name = "CategoryGenerator",
  6.             allocationSize = 1,
  7.             initialValue = 1)
  8.     @Id
  9.     @GeneratedValue(strategy = GenerationType.TABLE,
  10.             generator="CategoryGenerator")
  11.     @Column(name="categoryId")
  12.     private Long categoryId;
  13.     @Column(name="name")
  14.     private String Name;
  15.    
  16.     public Category(){
  17.        
  18.     }
  19.    
  20.     public Category(Long categoryId, String name) {
  21.         super();
  22.         categoryId = categoryId;
  23.         Name = name;
  24.     }
  25.    
  26.     public Long getCategoryId() {
  27.         return categoryId;
  28.     }
  29.     public void setCategoryId(Long categoryId) {
  30.         categoryId = categoryId;
  31.     }
  32.     public String getName() {
  33.         return Name;
  34.     }
  35.     public void setName(String name) {
  36.         Name = name;
  37.     }
  38.    
  39.     @Override
  40.     public int hashCode() {
  41.         int hash = 0;
  42.         hash += (categoryId != null ? categoryId.hashCode() : 0);
  43.         return hash;
  44.     }
  45.  
  46.     @Override
  47.     public boolean equals(Object object) {
  48.         // TODO: Warning - this method won't work in the case the id fields are not set
  49.         if (!(object instanceof Category)) {
  50.             return false;
  51.         }
  52.         Category other = (Category) object;
  53.         if ((this.categoryId == null && other.categoryId != null) || (this.categoryId != null && !this.categoryId.equals(other.categoryId))) {
  54.             return false;
  55.         }
  56.         return true;
  57.     }
  58.  
  59.     @Override
  60.     public String toString() {
  61.         return "model.Order[ id=" + categoryId + " ]";
  62.     }
  63.    
  64.    
  65. }
Advertisement
Add Comment
Please, Sign In to add comment