1 22 package org.jboss.ejb3.test.entity; 23 24 import java.util.Set ; 25 import javax.persistence.CascadeType; 26 import javax.persistence.Entity; 27 import javax.persistence.FetchType; 28 import javax.persistence.GeneratedValue; 29 import javax.persistence.GenerationType; 30 import javax.persistence.Id; 31 import javax.persistence.OneToMany; 32 33 34 39 @Entity() 40 public class Company implements java.io.Serializable 41 { 42 private Integer id; 43 private String name; 44 private Set <Flight> flights; 45 46 @Id 47 @GeneratedValue(strategy= GenerationType.AUTO) 48 public Integer getId() 49 { 50 return id; 51 } 52 53 public String getName() 54 { 55 return name; 56 } 57 58 59 public void setId(Integer integer) 60 { 61 id = integer; 62 } 63 64 65 public void setName(String string) 66 { 67 name = string; 68 } 69 70 71 @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy="company") 72 public Set <Flight> getFlights() 73 { 74 return flights; 75 } 76 77 public void setFlights(Set <Flight> flights) 78 { 79 this.flights = flights; 80 } 81 82 83 } 84 | Popular Tags |