📄 customer.java
字号:
/* * Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. U.S. * Government Rights - Commercial software. Government users are subject * to the Sun Microsystems, Inc. standard license agreement and * applicable provisions of the FAR and its supplements. Use is subject * to license terms. * * This distribution may include materials developed by third parties. * Sun, Sun Microsystems, the Sun logo, Java and J2EE are trademarks * or registered trademarks of Sun Microsystems, Inc. in the U.S. and * other countries. * * Copyright (c) 2006 Sun Microsystems, Inc. Tous droits reserves. * * Droits du gouvernement americain, utilisateurs gouvernementaux - logiciel * commercial. Les utilisateurs gouvernementaux sont soumis au contrat de * licence standard de Sun Microsystems, Inc., ainsi qu'aux dispositions * en vigueur de la FAR (Federal Acquisition Regulations) et des * supplements a celles-ci. Distribue par des licences qui en * restreignent l'utilisation. * * Cette distribution peut comprendre des composants developpes par des * tierces parties. Sun, Sun Microsystems, le logo Sun, Java et J2EE * sont des marques de fabrique ou des marques deposees de Sun * Microsystems, Inc. aux Etats-Unis et dans d'autres pays. */package com.sun.tutorial.javaee.dukesbank.entity;import java.util.Collection;import javax.persistence.Column;import javax.persistence.Entity;import javax.persistence.GeneratedValue;import javax.persistence.GenerationType;import javax.persistence.Id;import javax.persistence.ManyToMany;import javax.persistence.NamedQueries;import javax.persistence.NamedQuery;import javax.persistence.Table;import javax.persistence.TableGenerator;@Entity@Table(name = "BANK_CUSTOMER")@NamedQueries({ @NamedQuery(name = "Customer.FindById",query = "SELECT a FROM Customer a WHERE a.id = :id") , @NamedQuery(name = "Customer.FindByLastName", query = "SELECT a FROM Customer a WHERE a.lastName LIKE :lastName") , @NamedQuery(name = "Customer.FindByFirstName", query = "SELECT a FROM Customer a WHERE a.firstName = :firstName") , @NamedQuery(name = "Customer.FindByMiddleInitial", query = "SELECT a FROM Customer a WHERE a.middleInitial = :middleInitial") , @NamedQuery(name = "Customer.FindByStreet", query = "SELECT a FROM Customer a WHERE a.street = :street") , @NamedQuery(name = "Customer.FindByCity", query = "SELECT a FROM Customer a WHERE a.city = :city") , @NamedQuery(name = "Customer.FindByState", query = "SELECT a FROM Customer a WHERE a.state = :state") , @NamedQuery(name = "Customer.FindByZip", query = "SELECT a FROM Customer a WHERE a.zip = :zip") , @NamedQuery(name = "Customer.FindByPhone", query = "SELECT a FROM Customer a WHERE a.phone = :phone") , @NamedQuery(name = "Customer.FindByEmail", query = "SELECT a FROM Customer a WHERE a.email = :email") , @NamedQuery(name = "Customer.FindAllCustomersOfAccount", query = "SELECT c FROM Customer c JOIN c.accounts a WHERE a.id = :accountId")})public class Customer implements java.io.Serializable { @ManyToMany(mappedBy = "customers") private Collection<Account> accounts; @TableGenerator(name = "customerIdGen", table = "BANK_SEQUENCE_GENERATOR", pkColumnName = "GEN_KEY", valueColumnName = "GEN_VALUE", pkColumnValue = "CUSTOMER_ID", initialValue = 203, allocationSize = 1) @Id @GeneratedValue(strategy = GenerationType.TABLE, generator = "customerIdGen") @Column(name = "CUSTOMER_ID", nullable = false) private Long id; @Column(name = "CITY") private String city; @Column(name = "EMAIL") private String email; @Column(name = "FIRST_NAME") private String firstName; @Column(name = "LAST_NAME") private String lastName; @Column(name = "MIDDLE_INITIAL") private String middleInitial; @Column(name = "PHONE") private String phone; @Column(name = "STATE") private String state; @Column(name = "STREET") private String street; @Column(name = "ZIP") private String zip; /** Creates a new instance of Customer */ public Customer() { } public Customer( String lastName, String firstName, String middleInitial, String street, String city, String state, String zip, String phone, String email) { this.lastName = lastName; this.firstName = firstName; this.middleInitial = middleInitial; this.street = street; this.city = city; this.state = state; this.zip = zip; this.phone = phone; this.email = email; } public Long getCustomerId() { return this.id; } public void setCustomerId(Long customerId) { this.id = customerId; } public String getLastName() { return this.lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getFirstName() { return this.firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getMiddleInitial() { return this.middleInitial; } public void setMiddleInitial(String middleInitial) { this.middleInitial = middleInitial; } public String getStreet() { return this.street; } public void setStreet(String street) { this.street = street; } public String getCity() { return this.city; } public void setCity(String city) { this.city = city; } public String getState() { return this.state; } public void setState(String state) { this.state = state; } public String getZip() { return this.zip; } public void setZip(String zip) { this.zip = zip; } public String getPhone() { return this.phone; } public void setPhone(String phone) { this.phone = phone; } public String getEmail() { return this.email; } public void setEmail(String email) { this.email = email; } public Collection<Account> getAccounts() { return this.accounts; } public void setAccounts(Collection<Account> accountId) { this.accounts = accountId; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -