📄 vendorpart.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 order.entity;import javax.persistence.Entity;import javax.persistence.GeneratedValue;import javax.persistence.GenerationType;import javax.persistence.Id;import javax.persistence.JoinColumn;import javax.persistence.JoinColumns;import javax.persistence.ManyToOne;import javax.persistence.NamedQueries;import javax.persistence.NamedQuery;import javax.persistence.OneToOne;import javax.persistence.Table;import javax.persistence.TableGenerator;@Entity@Table(name = "EJB_ORDER_VENDOR_PART")@NamedQueries({ @NamedQuery(name = "findAverageVendorPartPrice",query = "SELECT AVG(vp.price) " + "FROM VendorPart vp") , @NamedQuery(name = "findTotalVendorPartPricePerVendor", query = "SELECT SUM(vp.price) " + "FROM VendorPart vp " + "WHERE vp.vendor.vendorId = :id")})public class VendorPart implements java.io.Serializable { private Long vendorPartNumber; private Part part; private String description; private Vendor vendor; private double price; public VendorPart() { } public VendorPart( String description, double price, Part part) { this.description = description; this.price = price; this.part = part; part.setVendorPart(this); } @TableGenerator(name = "vendorPartGen", table = "EJB_ORDER_SEQUENCE_GENERATOR", pkColumnName = "GEN_KEY", valueColumnName = "GEN_VALUE", pkColumnValue = "VENDOR_PART_ID", allocationSize = 10) @Id @GeneratedValue(strategy = GenerationType.TABLE, generator = "vendorPartGen") public Long getVendorPartNumber() { return vendorPartNumber; } public void setVendorPartNumber(Long vendorPartNumber) { this.vendorPartNumber = vendorPartNumber; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } @OneToOne @JoinColumns({ @JoinColumn(name = "PARTNUMBER",referencedColumnName = "PARTNUMBER") , @JoinColumn(name = "PARTREVISION", referencedColumnName = "REVISION") }) public Part getPart() { return part; } public void setPart(Part part) { this.part = part; } @JoinColumn(name = "VENDORID") @ManyToOne public Vendor getVendor() { return vendor; } public void setVendor(Vendor vendor) { this.vendor = vendor; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -