1 package org.hibernate.ejb.test; 3 4 import javax.persistence.Entity; 5 import javax.persistence.GeneratorType; 6 import javax.persistence.Id; 7 8 11 @Entity 12 public class Distributor { 13 private Integer id; 14 private String name; 15 16 @Id(generate = GeneratorType.AUTO) 17 public Integer getId() { 18 return id; 19 } 20 21 public void setId(Integer id) { 22 this.id = id; 23 } 24 25 public String getName() { 26 return name; 27 } 28 29 public void setName(String name) { 30 this.name = name; 31 } 32 33 public boolean equals(Object o) { 34 if ( this == o ) return true; 35 if ( !( o instanceof Distributor ) ) return false; 36 37 final Distributor distributor = (Distributor) o; 38 39 if ( !name.equals( distributor.name ) ) return false; 40 41 return true; 42 } 43 44 public int hashCode() { 45 return name.hashCode(); 46 } 47 } 48 | Popular Tags |