/*
 * 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 javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author developer2
 */
@Entity
@Table(name="COMACO.TCUSTNOTARYOFFICE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tcustnotaryoffice.findAll", query = "SELECT t FROM Tcustnotaryoffice t"),
    @NamedQuery(name = "Tcustnotaryoffice.findByPersoncode", query = "SELECT t FROM Tcustnotaryoffice t WHERE t.personcode = :personcode")})
public class Tcustnotaryoffice implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "PERSONCODE")
    private Long personcode;
    @JoinColumn(name = "PERSONCODE", referencedColumnName = "PERSONCODE", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Tcustperson tcustperson;

    public Tcustnotaryoffice() {
    }

    public Tcustnotaryoffice(Long personcode) {
        this.personcode = personcode;
    }

    public Long getPersoncode() {
        return personcode;
    }

    public void setPersoncode(Long personcode) {
        this.personcode = personcode;
    }

    public Tcustperson getTcustperson() {
        return tcustperson;
    }

    public void setTcustperson(Tcustperson tcustperson) {
        this.tcustperson = tcustperson;
    }

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

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