1 package org.hibernate.test.annotations.indexcoll; 3 4 import org.hibernate.annotations.IndexColumn; 5 6 import javax.persistence.Entity; 7 import javax.persistence.GeneratorType; 8 import javax.persistence.Id; 9 import javax.persistence.OneToMany; 10 import java.util.List ; 11 12 15 @Entity 16 public class Drawer { 17 private Long id; 18 private List <Dress> dresses; 19 20 @Id(generate = GeneratorType.AUTO) 21 public Long getId() { 22 return id; 23 } 24 25 public void setId(Long id) { 26 this.id = id; 27 } 28 29 33 @OneToMany 34 @IndexColumn(name="from_bottom_position") 35 public List <Dress> getDresses() { 36 return dresses; 37 } 38 39 public void setDresses(List <Dress> dresses) { 40 this.dresses = dresses; 41 } 42 43 public boolean equals(Object o) { 44 if ( this == o ) return true; 45 if ( !( o instanceof Drawer ) ) return false; 46 47 final Drawer drawer = (Drawer) o; 48 49 if ( !getId().equals( drawer.getId() ) ) return false; 50 51 return true; 52 } 53 54 public int hashCode() { 55 return getId().hashCode(); 56 } 57 } 58 | Popular Tags |