/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.qsoft.rs.sincoar.model;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author developer2
 */
@Entity
@Table(name="COMACO.TLOGLOAD")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tlogload.findAll", query = "SELECT t FROM Tlogload t"),
    @NamedQuery(name = "Tlogload.findByJournalid", query = "SELECT t FROM Tlogload t WHERE t.tlogloadPK.journalid = :journalid"),
    @NamedQuery(name = "Tlogload.findByLoadsequence", query = "SELECT t FROM Tlogload t WHERE t.tlogloadPK.loadsequence = :loadsequence"),
    @NamedQuery(name = "Tlogload.findByLoadid", query = "SELECT t FROM Tlogload t WHERE t.loadid = :loadid"),
    @NamedQuery(name = "Tlogload.findByStatus", query = "SELECT t FROM Tlogload t WHERE t.status = :status"),
    @NamedQuery(name = "Tlogload.findByAditionaldata", query = "SELECT t FROM Tlogload t WHERE t.aditionaldata = :aditionaldata")})
public class Tlogload implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TlogloadPK tlogloadPK;
    @Column(name = "LOADID")
    private String loadid;
    @Column(name = "STATUS")
    private String status;
    @Column(name = "ADITIONALDATA")
    private String aditionaldata;
    @JoinColumn(name = "JOURNALID", referencedColumnName = "JOURNALID", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tlogheader tlogheader;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tlogload")
    private Collection<Tlogloaderror> tlogloaderrorCollection;

    public Tlogload() {
    }

    public Tlogload(TlogloadPK tlogloadPK) {
        this.tlogloadPK = tlogloadPK;
    }

    public Tlogload(String journalid, long loadsequence) {
        this.tlogloadPK = new TlogloadPK(journalid, loadsequence);
    }

    public TlogloadPK getTlogloadPK() {
        return tlogloadPK;
    }

    public void setTlogloadPK(TlogloadPK tlogloadPK) {
        this.tlogloadPK = tlogloadPK;
    }

    public String getLoadid() {
        return loadid;
    }

    public void setLoadid(String loadid) {
        this.loadid = loadid;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getAditionaldata() {
        return aditionaldata;
    }

    public void setAditionaldata(String aditionaldata) {
        this.aditionaldata = aditionaldata;
    }

    public Tlogheader getTlogheader() {
        return tlogheader;
    }

    public void setTlogheader(Tlogheader tlogheader) {
        this.tlogheader = tlogheader;
    }

    @XmlTransient
    public Collection<Tlogloaderror> getTlogloaderrorCollection() {
        return tlogloaderrorCollection;
    }

    public void setTlogloaderrorCollection(Collection<Tlogloaderror> tlogloaderrorCollection) {
        this.tlogloaderrorCollection = tlogloaderrorCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tlogloadPK != null ? tlogloadPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tlogload)) {
            return false;
        }
        Tlogload other = (Tlogload) object;
        if ((this.tlogloadPK == null && other.tlogloadPK != null) || (this.tlogloadPK != null && !this.tlogloadPK.equals(other.tlogloadPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.qsoft.rs.sincoar.model.Tlogload[ tlogloadPK=" + tlogloadPK + " ]";
    }
    
}
