1 package org.hibernate.test.annotations.referencedcolumnname; 3 4 import javax.persistence.Entity; 5 import javax.persistence.Id; 6 import javax.persistence.GeneratorType; 7 8 11 @Entity 12 public class Clothes { 13 private Integer id; 14 private String type; 15 private String flavor; 16 17 public Clothes() { 18 } 19 20 public Clothes(String type, String flavor) { 21 this.type = type; 22 this.flavor = flavor; 23 } 24 25 @Id(generate = GeneratorType.AUTO) 26 public Integer getId() { 27 return id; 28 } 29 30 public void setId(Integer id) { 31 this.id = id; 32 } 33 34 public String getType() { 35 return type; 36 } 37 38 public void setType(String type) { 39 this.type = type; 40 } 41 42 public String getFlavor() { 43 return flavor; 44 } 45 46 public void setFlavor(String flavor) { 47 this.flavor = flavor; 48 } 49 50 public boolean equals(Object o) { 51 if ( this == o ) return true; 52 if ( !( o instanceof Clothes ) ) return false; 53 54 final Clothes clothes = (Clothes) o; 55 56 if ( !flavor.equals( clothes.flavor ) ) return false; 57 if ( !type.equals( clothes.type ) ) return false; 58 59 return true; 60 } 61 62 public int hashCode() { 63 int result; 64 result = type.hashCode(); 65 result = 29 * result + flavor.hashCode(); 66 return result; 67 } 68 } 69 | Popular Tags |