0

productという名前のこのエンティティがあります。一連の複数のキーを追加する方法はありますか?シリアル番号のキー、シリアル番号とモデルのキー、モデルのキーなどのように。これをどのように行うことができますか?どうもありがとうございます。

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

あなたが探しているものは根本的に間違っていると思います。キーは、エンティティのインスタンスの一意の識別子である必要があります。あなたの例では、「モデル」のキーが必要ですが、正しく聞こえません。

「キー」に別の意味がある場合は、明確にしてください。さらに議論する可能性があります。

于 2013-02-19T03:29:16.717 に答える