0

我有这个名为产品的实体。有没有办法添加一系列多个键?就像序列号的钥匙,序列号和型号的钥匙,型号的钥匙等。你怎么能这样做?非常感谢。

*
 * 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;
    }


}
4

1 回答 1

0

我相信您正在寻找的内容从根本上是不正确的。Key 应该是实体实例的唯一标识符。在您的示例中,您希望为“模型”设置一个键,这听起来不正确。

如果您对“Key”有其他含义,请澄清,我们可能会进一步讨论。

于 2013-02-19T03:29:16.717 回答