customer.java
来自「Store Manager」· Java 代码 · 共 121 行
JAVA
121 行
/* * Customer.java * * Created on 2007-6-1, 14:22:21 * * To change this template, choose Tools | Template Manager * and open the template in the editor. */package com.studio009.store.entity;import java.io.Serializable;import java.util.Collection;import javax.persistence.CascadeType;import javax.persistence.Column;import javax.persistence.Entity;import javax.persistence.Id;import javax.persistence.NamedQueries;import javax.persistence.NamedQuery;import javax.persistence.OneToMany;import javax.persistence.Table;/** * 客户实体类 * <p> * 该类对应数据库的表, * 数据库每个字段可以找到一个属性. * 详情参加数据库设计书. * </p> * @author wangs */@Entity@Table(name = "customer")@NamedQueries( {@NamedQuery(name = "Customer.findByCustomerName", query = "SELECT c FROM Customer c WHERE c.customerName = :customerName"), @NamedQuery(name = "Customer.findByCustomerPhone", query = "SELECT c FROM Customer c WHERE c.customerPhone = :customerPhone"), @NamedQuery(name = "Customer.findByCustomerAddress", query = "SELECT c FROM Customer c WHERE c.customerAddress = :customerAddress"), @NamedQuery(name = "Customer.findByCustomerNote", query = "SELECT c FROM Customer c WHERE c.customerNote = :customerNote")})public class Customer implements Serializable { @Id @Column(name = "customerName", nullable = false) private String customerName; @Column(name = "customerPhone") private String customerPhone; @Column(name = "customerAddress") private String customerAddress; @Column(name = "customerNote") private String customerNote; @OneToMany(cascade = CascadeType.ALL, mappedBy = "customerName") private Collection<Sale> saleCollection; public Customer() { } public Customer(String customerName) { this.customerName = customerName; } public String getCustomerName() { return customerName; } public void setCustomerName(String customerName) { this.customerName = customerName; } public String getCustomerPhone() { return customerPhone; } public void setCustomerPhone(String customerPhone) { this.customerPhone = customerPhone; } public String getCustomerAddress() { return customerAddress; } public void setCustomerAddress(String customerAddress) { this.customerAddress = customerAddress; } public String getCustomerNote() { return customerNote; } public void setCustomerNote(String customerNote) { this.customerNote = customerNote; } public Collection<Sale> getSaleCollection() { return saleCollection; } public void setSaleCollection(Collection<Sale> saleCollection) { this.saleCollection = saleCollection; } @Override public int hashCode() { int hash = 0; hash += (customerName != null ? customerName.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 Customer)) { return false; } Customer other = (Customer) object; if (this.customerName != other.customerName && (this.customerName == null || !this.customerName.equals(other.customerName))) { return false; } return true; } @Override public String toString() { return "com.studio009.store.entity.Customer[customerName=" + customerName + "]"; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?