我有這個實體命名產品。有沒有辦法添加一系列多個鍵?像序列號的關鍵字,序列號和模型的關鍵字,模型的關鍵字等。您如何做到這一點?非常感謝你。如何在實體上添加一系列密鑰? Openjpa
*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package lotmovement.business.entity;
import java.io.Serializable;
import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Version;
/**
*
* @author god-gavedmework
*/
@Entity
public class Product implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long product_Id;
@Column(name = "SERIAL_NUMBER", nullable = false,length = 30)
private String serial_Number;
@Column(name = "DATE_ASSEMBLED", nullable = false,length = 10)
private String date_Assembled;
@Column(name = "TIME_ASSEMBLED", nullable = false,length = 20)
private String time_Assembled;
@Column(name = "MODEL", nullable = false,length = 20)
private String model;
@Column(name = "BATCH_ID", nullable = false,length = 6)
private int batch_Id;
@Column(name = "PROCESS_CODE", nullable = false,length = 3)
private int process_Code;
@Column(name = "DC_POWER_PCB_SERIAL", nullable = false,length = 20)
private String dc_Power_PCB_Serial;
@Column(name = "CONTROL_PWER_PCB_SERIAL", nullable = false,length = 20)
private String control_Power_PCB_Serial;
@Column(name = "MAINS_POWER_PCB_SERIAL", nullable = false,length = 20)
private String mains_Power_PCB_Serial;
@Column(name = "BLOWER_SERIAL", nullable = false,length = 20)
private String blower_Serial;
@Column(name = "HEATERPLATE_SERIAL", nullable = false,length = 20)
private String heaterPlate_Serial;
@Column(name = "LAST_PROCESS", nullable = false,length = 3)
private String last_Process;
@Column(name = "LAST_DATE", nullable = false,length = 20)
private String last_Date;
@Version
@Column(name = "LAST_UPDATED_TIME")
private java.sql.Timestamp updatedTime;
public Timestamp getUpdatedTime() {
return updatedTime;
}
public void setUpdatedTime(Timestamp updatedTime) {
this.updatedTime = updatedTime;
}
public Long getProduct_Id() {
return product_Id;
}
public void setProduct_Id(Long product_Id) {
this.product_Id = product_Id;
}
public String getSerial_Number() {
return serial_Number;
}
public void setSerial_Number(String serial_Number) {
this.serial_Number = serial_Number;
}
public String getDate_Assembled() {
return date_Assembled;
}
public void setDate_Assembled(String date_Assembled) {
this.date_Assembled = date_Assembled;
}
public String getTime_Assembled() {
return time_Assembled;
}
public void setTime_Assembled(String time_Assembled) {
this.time_Assembled = time_Assembled;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public int getBatch_Id() {
return batch_Id;
}
public void setBatch_Id(int batch_Id) {
this.batch_Id = batch_Id;
}
public int getProcess_Code() {
return process_Code;
}
public void setProcess_Code(int process_Code) {
this.process_Code = process_Code;
}
public String getDc_Power_PCB_Serial() {
return dc_Power_PCB_Serial;
}
public void setDc_Power_PCB_Serial(String dc_Power_PCB_Serial) {
this.dc_Power_PCB_Serial = dc_Power_PCB_Serial;
}
public String getControl_Power_PCB_Serial() {
return control_Power_PCB_Serial;
}
public void setControl_Power_PCB_Serial(String control_Power_PCB_Serial) {
this.control_Power_PCB_Serial = control_Power_PCB_Serial;
}
public String getMains_Power_PCB_Serial() {
return mains_Power_PCB_Serial;
}
public void setMains_Power_PCB_Serial(String mains_Power_PCB_Serial) {
this.mains_Power_PCB_Serial = mains_Power_PCB_Serial;
}
public String getBlower_Serial() {
return blower_Serial;
}
public void setBlower_Serial(String blower_Serial) {
this.blower_Serial = blower_Serial;
}
public String getHeaterPlate_Serial() {
return heaterPlate_Serial;
}
public void setHeaterPlate_Serial(String heaterPlate_Serial) {
this.heaterPlate_Serial = heaterPlate_Serial;
}
public String getLast_Process() {
return last_Process;
}
public void setLast_Process(String last_Process) {
this.last_Process = last_Process;
}
public String getLast_Date() {
return last_Date;
}
public void setLast_Date(String last_Date) {
this.last_Date = last_Date;
}
}
爲什麼你想這樣做,你認爲什麼是好處? – Romski 2013-02-19 02:42:21
在DB2數據庫中。有一個叫做邏輯文件的東西。它連接到桌子上。在一張表中你可以有許多邏輯文件。對於表格產品,我可以有一個邏輯文件,它有一個模型密鑰,另一個我可以有一個序列號的密鑰,另一個模型和序列號的密鑰。 [link](http://stackoverflow.com/questions/7045254/as-400-db2-logical-file-vs-table-index) – user1917456 2013-02-19 20:19:59