/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package TestRest;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
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.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author aparnab
 */
@Entity
@Table(name = "ASSOCAMO")
@NamedQueries({@NamedQuery(name = "Assocamo.findAll", query = "SELECT a FROM Assocamo a"),
@NamedQuery(name = "Assocamo.findByOrid", query = "SELECT a FROM Assocamo a WHERE a.assocamoPK.orid = :orid"),
@NamedQuery(name = "Assocamo.findByAmpid", query = "SELECT a FROM Assocamo a WHERE a.assocamoPK.ampid = :ampid"),
@NamedQuery(name = "Assocamo.findByCommid", query = "SELECT a FROM Assocamo a WHERE a.commid = :commid"),
@NamedQuery(name = "Assocamo.findByAuth", query = "SELECT a FROM Assocamo a WHERE a.auth = :auth"),
@NamedQuery(name = "Assocamo.findBySubsource", query = "SELECT a FROM Assocamo a WHERE a.subsource = :subsource"),
@NamedQuery(name = "Assocamo.findByDelta", query = "SELECT a FROM Assocamo a WHERE a.delta = :delta"),
@NamedQuery(name = "Assocamo.findBySeaz", query = "SELECT a FROM Assocamo a WHERE a.seaz = :seaz"),
@NamedQuery(name = "Assocamo.findByRflag", query = "SELECT a FROM Assocamo a WHERE a.rflag = :rflag"),
@NamedQuery(name = "Assocamo.findByLddate", query = "SELECT a FROM Assocamo a WHERE a.lddate = :lddate")})
public class Assocamo implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected AssocamoPK assocamoPK;
    @Column(name = "COMMID")
    private Long commid;
    @Basic(optional = false)
    @Column(name = "AUTH")
    private String auth;
    @Column(name = "SUBSOURCE")
    private String subsource;
    @Column(name = "DELTA")
    private BigDecimal delta;
    @Column(name = "SEAZ")
    private BigDecimal seaz;
    @Column(name = "RFLAG")
    private String rflag;
    @Column(name = "LDDATE")
    @Temporal(TemporalType.DATE)
    private Date lddate;
    @JoinColumn(name = "AMPID", referencedColumnName = "AMPID", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Amp amp;

    public Assocamo() {
    }

    public Assocamo(AssocamoPK assocamoPK) {
        this.assocamoPK = assocamoPK;
    }

    public Assocamo(AssocamoPK assocamoPK, String auth) {
        this.assocamoPK = assocamoPK;
        this.auth = auth;
    }

    public Assocamo(long orid, long ampid) {
        this.assocamoPK = new AssocamoPK(orid, ampid);
    }

    public AssocamoPK getAssocamoPK() {
        return assocamoPK;
    }

    public void setAssocamoPK(AssocamoPK assocamoPK) {
        this.assocamoPK = assocamoPK;
    }

    public Long getCommid() {
        return commid;
    }

    public void setCommid(Long commid) {
        this.commid = commid;
    }

    public String getAuth() {
        return auth;
    }

    public void setAuth(String auth) {
        this.auth = auth;
    }

    public String getSubsource() {
        return subsource;
    }

    public void setSubsource(String subsource) {
        this.subsource = subsource;
    }

    public BigDecimal getDelta() {
        return delta;
    }

    public void setDelta(BigDecimal delta) {
        this.delta = delta;
    }

    public BigDecimal getSeaz() {
        return seaz;
    }

    public void setSeaz(BigDecimal seaz) {
        this.seaz = seaz;
    }

    public String getRflag() {
        return rflag;
    }

    public void setRflag(String rflag) {
        this.rflag = rflag;
    }

    public Date getLddate() {
        return lddate;
    }

    public void setLddate(Date lddate) {
        this.lddate = lddate;
    }

    public Amp getAmp() {
        return amp;
    }

    public void setAmp(Amp amp) {
        this.amp = amp;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (assocamoPK != null ? assocamoPK.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 Assocamo)) {
            return false;
        }
        Assocamo other = (Assocamo) object;
        if ((this.assocamoPK == null && other.assocamoPK != null) || (this.assocamoPK != null && !this.assocamoPK.equals(other.assocamoPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "TestRest.Assocamo[assocamoPK=" + assocamoPK + "]";
    }

}
