1 package org.hibernate.test.annotations.indexcoll; 3 4 import org.hibernate.annotations.IndexColumn; 5 6 import javax.persistence.CascadeType; 7 import javax.persistence.Entity; 8 import javax.persistence.GeneratorType; 9 import javax.persistence.Id; 10 import javax.persistence.JoinColumn; 11 import javax.persistence.OneToMany; 12 import java.util.List ; 13 14 17 @Entity 18 public class Wardrobe { 19 20 private Long id; 21 private List <Drawer> drawers; 22 23 @Id(generate = GeneratorType.TABLE) 24 public Long getId() { 25 return id; 26 } 27 28 public void setId(Long id) { 29 this.id = id; 30 } 31 32 36 @OneToMany(cascade = CascadeType.ALL) 37 @IndexColumn(name = "drawer_position", base=1) 38 @JoinColumn(name="wardrobe_id", nullable = false) 39 public List <Drawer> getDrawers() { 40 return drawers; 41 } 42 43 public void setDrawers(List <Drawer> drawers) { 44 this.drawers = drawers; 45 } 46 } 47 | Popular Tags |