1 9 10 package org.demo; 11 12 import java.io.Serializable ; 13 import java.math.BigDecimal ; 14 import java.util.Date ; 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.Table; 23 import javax.persistence.Temporal; 24 import javax.persistence.TemporalType; 25 26 30 @Entity 31 @Table(name = "ORDERS") 32 @NamedQueries( {@NamedQuery(name = "Orders.findByOrderNum", query = "SELECT o FROM Orders o WHERE o.orderNum = :orderNum"), @NamedQuery(name = "Orders.findByQuantity", query = "SELECT o FROM Orders o WHERE o.quantity = :quantity"), @NamedQuery(name = "Orders.findByShippingCost", query = "SELECT o FROM Orders o WHERE o.shippingCost = :shippingCost"), @NamedQuery(name = "Orders.findBySalesDate", query = "SELECT o FROM Orders o WHERE o.salesDate = :salesDate"), @NamedQuery(name = "Orders.findByShippingDate", query = "SELECT o FROM Orders o WHERE o.shippingDate = :shippingDate"), @NamedQuery(name = "Orders.findByFreightCompany", query = "SELECT o FROM Orders o WHERE o.freightCompany = :freightCompany")}) 33 public class Orders implements Serializable { 34 35 @Id 36 @Column(name = "ORDER_NUM", nullable = false) 37 private Integer orderNum; 38 39 @Column(name = "QUANTITY") 40 private Short quantity; 41 42 @Column(name = "SHIPPING_COST") 43 private BigDecimal shippingCost; 44 45 @Column(name = "SALES_DATE") 46 @Temporal(TemporalType.DATE) 47 private Date salesDate; 48 49 @Column(name = "SHIPPING_DATE") 50 @Temporal(TemporalType.DATE) 51 private Date shippingDate; 52 53 @Column(name = "FREIGHT_COMPANY") 54 private String freightCompany; 55 56 @JoinColumn(name = "CUSTOMER_ID") 57 @ManyToOne 58 private Customer customerId; 59 60 @JoinColumn(name = "PRODUCT_ID") 61 @ManyToOne 62 private Product productId; 63 64 65 public Orders() { 66 } 67 68 public Orders(Integer orderNum) { 69 this.orderNum = orderNum; 70 } 71 72 public Integer getOrderNum() { 73 return this.orderNum; 74 } 75 76 public void setOrderNum(Integer orderNum) { 77 this.orderNum = orderNum; 78 } 79 80 public Short getQuantity() { 81 return this.quantity; 82 } 83 84 public void setQuantity(Short quantity) { 85 this.quantity = quantity; 86 } 87 88 public BigDecimal getShippingCost() { 89 return this.shippingCost; 90 } 91 92 public void setShippingCost(BigDecimal shippingCost) { 93 this.shippingCost = shippingCost; 94 } 95 96 public Date getSalesDate() { 97 return this.salesDate; 98 } 99 100 public void setSalesDate(Date salesDate) { 101 this.salesDate = salesDate; 102 } 103 104 public Date getShippingDate() { 105 return this.shippingDate; 106 } 107 108 public void setShippingDate(Date shippingDate) { 109 this.shippingDate = shippingDate; 110 } 111 112 public String getFreightCompany() { 113 return this.freightCompany; 114 } 115 116 public void setFreightCompany(String freightCompany) { 117 this.freightCompany = freightCompany; 118 } 119 120 public Customer getCustomerId() { 121 return this.customerId; 122 } 123 124 public void setCustomerId(Customer customerId) { 125 this.customerId = customerId; 126 } 127 128 public Product getProductId() { 129 return this.productId; 130 } 131 132 public void setProductId(Product productId) { 133 this.productId = productId; 134 } 135 136 public int hashCode() { 137 int hash = 0; 138 hash += (this.orderNum != null ? this.orderNum.hashCode() : 0); 139 return hash; 140 } 141 142 public boolean equals(Object object) { 143 if (!(object instanceof Orders)) { 144 return false; 145 } 146 Orders other = (Orders)object; 147 if (this.orderNum != other.orderNum && (this.orderNum == null || !this.orderNum.equals(other.orderNum))) return false; 148 return true; 149 } 150 151 public String toString() { 152 return "" + this.orderNum; 154 } 155 156 } 157 | Popular Tags |