1 9 10 package org.demo; 11 12 import java.io.Serializable ; 13 import java.math.BigDecimal ; 14 import javax.persistence.CascadeType; 15 import javax.persistence.Column; 16 import javax.persistence.Entity; 17 import javax.persistence.Id; 18 import javax.persistence.JoinColumn; 19 import javax.persistence.ManyToOne; 20 import javax.persistence.NamedQueries; 21 import javax.persistence.NamedQuery; 22 import javax.persistence.OneToMany; 23 import javax.persistence.Table; 24 25 29 @Entity 30 @Table(name = "PRODUCT") 31 @NamedQueries( {@NamedQuery(name = "Product.findByProductId", query = "SELECT p FROM Product p WHERE p.productId = :productId"), @NamedQuery(name = "Product.findByPurchaseCost", query = "SELECT p FROM Product p WHERE p.purchaseCost = :purchaseCost"), @NamedQuery(name = "Product.findByQuantityOnHand", query = "SELECT p FROM Product p WHERE p.quantityOnHand = :quantityOnHand"), @NamedQuery(name = "Product.findByMarkup", query = "SELECT p FROM Product p WHERE p.markup = :markup"), @NamedQuery(name = "Product.findByAvailable", query = "SELECT p FROM Product p WHERE p.available = :available"), @NamedQuery(name = "Product.findByDescription", query = "SELECT p FROM Product p WHERE p.description = :description")}) 32 public class Product implements Serializable { 33 34 @Id 35 @Column(name = "PRODUCT_ID", nullable = false) 36 private Integer productId; 37 38 @Column(name = "PURCHASE_COST") 39 private BigDecimal purchaseCost; 40 41 @Column(name = "QUANTITY_ON_HAND") 42 private Integer quantityOnHand; 43 44 @Column(name = "MARKUP") 45 private BigDecimal markup; 46 47 @Column(name = "AVAILABLE") 48 private String available; 49 50 @Column(name = "DESCRIPTION") 51 private String description; 52 53 @JoinColumn(name = "MANUFACTURE_ID") 54 @ManyToOne 55 private org.demo.Manufacture manufactureId; 56 57 @JoinColumn(name = "PRODUCT_CODE") 58 @ManyToOne 59 private org.demo.ProductCode productCode; 60 61 @OneToMany(cascade = CascadeType.ALL, mappedBy = "productId") 62 private java.util.Collection <org.demo.Orders> orders; 63 64 65 public Product() { 66 } 67 68 public Product(Integer productId) { 69 this.productId = productId; 70 } 71 72 public Integer getProductId() { 73 return this.productId; 74 } 75 76 public void setProductId(Integer productId) { 77 this.productId = productId; 78 } 79 80 public BigDecimal getPurchaseCost() { 81 return this.purchaseCost; 82 } 83 84 public void setPurchaseCost(BigDecimal purchaseCost) { 85 this.purchaseCost = purchaseCost; 86 } 87 88 public Integer getQuantityOnHand() { 89 return this.quantityOnHand; 90 } 91 92 public void setQuantityOnHand(Integer quantityOnHand) { 93 this.quantityOnHand = quantityOnHand; 94 } 95 96 public BigDecimal getMarkup() { 97 return this.markup; 98 } 99 100 public void setMarkup(BigDecimal markup) { 101 this.markup = markup; 102 } 103 104 public String getAvailable() { 105 return this.available; 106 } 107 108 public void setAvailable(String available) { 109 this.available = available; 110 } 111 112 public String getDescription() { 113 return this.description; 114 } 115 116 public void setDescription(String description) { 117 this.description = description; 118 } 119 120 public org.demo.Manufacture getManufactureId() { 121 return this.manufactureId; 122 } 123 124 public void setManufactureId(org.demo.Manufacture manufactureId) { 125 this.manufactureId = manufactureId; 126 } 127 128 public org.demo.ProductCode getProductCode() { 129 return this.productCode; 130 } 131 132 public void setProductCode(org.demo.ProductCode productCode) { 133 this.productCode = productCode; 134 } 135 136 public java.util.Collection <org.demo.Orders> getOrders() { 137 return this.orders; 138 } 139 140 public void setOrders(java.util.Collection <org.demo.Orders> orders) { 141 this.orders = orders; 142 } 143 144 public int hashCode() { 145 int hash = 0; 146 hash += (this.productId != null ? this.productId.hashCode() : 0); 147 return hash; 148 } 149 150 public boolean equals(Object object) { 151 if (!(object instanceof Product)) { 152 return false; 153 } 154 Product other = (Product)object; 155 if (this.productId != other.productId && (this.productId == null || !this.productId.equals(other.productId))) return false; 156 return true; 157 } 158 159 public String toString() { 160 return "" + this.productId; 162 } 163 164 } 165 | Popular Tags |