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_CH4")
@SequenceGenerator(name = "SEQ_PG_CH4_ID", sequenceName = "SEQ_PG_CH4_ID",allocationSize=1,initialValue=1)
public class PgCh4 implements Serializable {

    private static final long serialVersionUID = 1L;
    private long id;
    private String ch4;
    private Date logTime;
    private Date upTime;
    private PgDevice pgDeviceId;

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

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

    @Column(name = "CH4")
    public String getCh4() {
        return ch4;
    }

    public void setCh4(String ch4) {
        this.ch4 = ch4;
    }

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

}
