1 22 package org.jboss.ejb3.test.relationships; 23 24 import java.util.Collection ; 25 import javax.persistence.Entity; 26 import javax.persistence.JoinColumn; 27 import javax.persistence.OneToMany; 28 import javax.persistence.Id; 29 import javax.persistence.CascadeType; 30 31 36 @Entity 37 public class Category 38 { 39 private long id; 40 private Collection <Item> items; 41 42 @Id 43 public long getId() 44 { 45 return id; 46 } 47 48 public void setId(long id) 49 { 50 this.id = id; 51 } 52 53 @OneToMany(cascade={CascadeType.ALL}) 54 @JoinColumn(name="CATEGORY_ID") 55 public Collection <Item> getItems() 56 { 57 return items; 58 } 59 60 public void setItems(Collection <Item> items) 61 { 62 this.items = items; 63 } 64 65 } 66 | Popular Tags |