package com.casic.PgInterface.devData.domain;

import com.casic.PgInterface.devTable.domain.PgDevice;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * Created by yxw on 2017/11/28.
 */
@Entity
@Table(name = "PG_Sh")
@SequenceGenerator(name = "SEQ_PG_Sh_ID", sequenceName = "SEQ_PG_Sh_ID",allocationSize=1,initialValue=1)
public class PgSh implements Serializable {
    private static final long serialVersionUID = 1L;
    private long id;
    private String sh;
    private Date logTime;
    private Date upTime;
    private PgDevice pgDeviceId;

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_Sh_ID")
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @Column(name = "SH")
    public String getSh() {
        return sh;
    }

    public void setSh(String sh) {
        this.sh = sh;
    }

    @Column(name = "LOGTIME")
    public Date getLogTime() {
        return logTime;
    }

    public void setLogTime(Date logTime) {
        this.logTime = logTime;
    }

    @Column(name = "UPTIME")
    public Date getUpTime() {
        return upTime;
    }

    public void setUpTime(Date upTime) {
        this.upTime = upTime;
    }

    @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
    @NotFound(action = NotFoundAction.IGNORE)
    @JoinColumn(name = "PGDEVICEID")
    public PgDevice getPgDeviceId() {
        return pgDeviceId;
    }

    public void setPgDeviceId(PgDevice pgDeviceId) {
        this.pgDeviceId = pgDeviceId;
    }

}
