1 25 package org.objectweb.easybeans.tests.common.ejbs.entity.customer; 26 27 import java.io.Serializable ; 28 import java.util.List ; 29 30 import javax.persistence.CascadeType; 31 import javax.persistence.Entity; 32 import javax.persistence.Id; 33 import javax.persistence.ManyToOne; 34 import javax.persistence.OneToMany; 35 36 41 @Entity 42 public class ProductOrder implements Serializable { 43 44 47 private static final long serialVersionUID = 6701790488965035830L; 48 49 52 private long id; 53 54 57 private String description; 58 59 62 private Customer customer; 63 64 67 private List <Product> products; 68 69 76 public ProductOrder(final long id, final String description, final Customer customer, final List <Product> products) { 77 this.id = id; 78 this.description = description; 79 this.customer = customer; 80 this.products = products; 81 } 82 83 86 public ProductOrder() { 87 88 } 89 90 94 public Customer getCustomer() { 95 return customer; 96 } 97 98 102 @ManyToOne 103 public void setCustomer(final Customer customer) { 104 this.customer = customer; 105 } 106 107 111 public String getDescription() { 112 return description; 113 } 114 115 119 public void setDescription(final String description) { 120 this.description = description; 121 } 122 123 127 @Id 128 public long getId() { 129 return id; 130 } 131 132 136 public void setId(final long id) { 137 this.id = id; 138 } 139 140 144 @OneToMany(mappedBy = "order", cascade = CascadeType.REMOVE) 145 public List <Product> getProducts() { 146 return products; 147 } 148 149 153 public void setProducts(final List <Product> products) { 154 this.products = products; 155 } 156 157 } 158 | Popular Tags |