| /* |
| * Licensed to the Apache Software Foundation (ASF) under one |
| * or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information |
| * regarding copyright ownership. The ASF licenses this file |
| * to you under the Apache License, Version 2.0 (the |
| * "License"); you may not use this file except in compliance |
| * with the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, |
| * software distributed under the License is distributed on an |
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| * KIND, either express or implied. See the License for the |
| * specific language governing permissions and limitations |
| * under the License. |
| */ |
| |
| package com.acme; |
| |
| import java.io.Serializable; |
| import java.math.BigDecimal; |
| import java.util.Date; |
| import javax.persistence.Column; |
| import javax.persistence.Entity; |
| import javax.persistence.Id; |
| import javax.persistence.JoinColumn; |
| import javax.persistence.ManyToOne; |
| import javax.persistence.NamedQueries; |
| import javax.persistence.NamedQuery; |
| import javax.persistence.Table; |
| import javax.persistence.Temporal; |
| import javax.persistence.TemporalType; |
| |
| /** |
| * |
| * @author nam |
| */ |
| @Entity |
| @Table(name = "PURCHASE_ORDER") |
| @NamedQueries({@NamedQuery(name = "PurchaseOrder.findByOrderNum", query = "SELECT p FROM PurchaseOrder p WHERE p.orderNum = :orderNum"), @NamedQuery(name = "PurchaseOrder.findByQuantity", query = "SELECT p FROM PurchaseOrder p WHERE p.quantity = :quantity"), @NamedQuery(name = "PurchaseOrder.findByShippingCost", query = "SELECT p FROM PurchaseOrder p WHERE p.shippingCost = :shippingCost"), @NamedQuery(name = "PurchaseOrder.findBySalesDate", query = "SELECT p FROM PurchaseOrder p WHERE p.salesDate = :salesDate"), @NamedQuery(name = "PurchaseOrder.findByShippingDate", query = "SELECT p FROM PurchaseOrder p WHERE p.shippingDate = :shippingDate"), @NamedQuery(name = "PurchaseOrder.findByFreightCompany", query = "SELECT p FROM PurchaseOrder p WHERE p.freightCompany = :freightCompany")}) |
| public class PurchaseOrder implements Serializable { |
| @Id |
| @Column(name = "ORDER_NUM", nullable = false) |
| private Integer orderNum; |
| @Column(name = "QUANTITY") |
| private Short quantity; |
| @Column(name = "SHIPPING_COST") |
| private BigDecimal shippingCost; |
| @Column(name = "SALES_DATE") |
| @Temporal(TemporalType.DATE) |
| private Date salesDate; |
| @Column(name = "SHIPPING_DATE") |
| @Temporal(TemporalType.DATE) |
| private Date shippingDate; |
| @Column(name = "FREIGHT_COMPANY") |
| private String freightCompany; |
| @JoinColumn(name = "CUSTOMER_ID", referencedColumnName = "CUSTOMER_ID") |
| @ManyToOne |
| private Customer customerId; |
| @JoinColumn(name = "PRODUCT_ID", referencedColumnName = "PRODUCT_ID") |
| @ManyToOne |
| private Product productId; |
| |
| public PurchaseOrder() { |
| } |
| |
| public PurchaseOrder(Integer orderNum) { |
| this.orderNum = orderNum; |
| } |
| |
| public Integer getOrderNum() { |
| return orderNum; |
| } |
| |
| public void setOrderNum(Integer orderNum) { |
| this.orderNum = orderNum; |
| } |
| |
| public Short getQuantity() { |
| return quantity; |
| } |
| |
| public void setQuantity(Short quantity) { |
| this.quantity = quantity; |
| } |
| |
| public BigDecimal getShippingCost() { |
| return shippingCost; |
| } |
| |
| public void setShippingCost(BigDecimal shippingCost) { |
| this.shippingCost = shippingCost; |
| } |
| |
| public Date getSalesDate() { |
| return salesDate; |
| } |
| |
| public void setSalesDate(Date salesDate) { |
| this.salesDate = salesDate; |
| } |
| |
| public Date getShippingDate() { |
| return shippingDate; |
| } |
| |
| public void setShippingDate(Date shippingDate) { |
| this.shippingDate = shippingDate; |
| } |
| |
| public String getFreightCompany() { |
| return freightCompany; |
| } |
| |
| public void setFreightCompany(String freightCompany) { |
| this.freightCompany = freightCompany; |
| } |
| |
| public Customer getCustomerId() { |
| return customerId; |
| } |
| |
| public void setCustomerId(Customer customerId) { |
| this.customerId = customerId; |
| } |
| |
| public Product getProductId() { |
| return productId; |
| } |
| |
| public void setProductId(Product productId) { |
| this.productId = productId; |
| } |
| |
| @Override |
| public int hashCode() { |
| int hash = 0; |
| hash += (orderNum != null ? orderNum.hashCode() : 0); |
| return hash; |
| } |
| |
| @Override |
| public boolean equals(Object object) { |
| // TODO: Warning - this method won't work in the case the id fields are not set |
| if (!(object instanceof PurchaseOrder)) { |
| return false; |
| } |
| PurchaseOrder other = (PurchaseOrder) object; |
| if (this.orderNum != other.orderNum && (this.orderNum == null || !this.orderNum.equals(other.orderNum))) { |
| return false; |
| } |
| return true; |
| } |
| |
| @Override |
| public String toString() { |
| return "test.PurchaseOrder[orderNum=" + orderNum + "]"; |
| } |
| |
| } |