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

package com.actiwaves.swing.TestSwing;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author sudeep.panchal
 */
@Entity
@Table(name = "contacttypes")
@NamedQueries( {@NamedQuery(name = "Contacttypes.findByContactType",query = "SELECT c FROM Contacttypes c WHERE c.contactType = :contactType"),@NamedQuery(name = "Contacttypes.findByDescription",query = "SELECT c FROM Contacttypes c WHERE c.description = :description")})
public class Contacttypes implements Serializable {
    @Transient
    private
    PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final
    long serialVersionUID = 1L;
    @Id
    @Column(name = "ContactType",nullable = false)
    private
    Short contactType;
    @Column(name = "Description",nullable = false)
    private
    String description;

    public
    Contacttypes()
    {
    }

    public
    Contacttypes(Short contactType)
    {
        this.contactType = contactType;
    }

    public
    Contacttypes(Short contactType,String description)
    {
        this.contactType = contactType;
        this.description = description;
    }

    public
    Short getContactType()
    {
        return contactType;
    }

    public
    void setContactType(Short contactType)
    {
        Short oldContactType = this.contactType;
        this.contactType = contactType;
        changeSupport.firePropertyChange("contactType",oldContactType,contactType);
    }

    public
    String getDescription()
    {
        return description;
    }

    public
    void setDescription(String description)
    {
        String oldDescription = this.description;
        this.description = description;
        changeSupport.firePropertyChange("description",oldDescription,description);
    }

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

    @Override
    public
    String toString()
    {
        return "com.actiwaves.swing.TestSwing.Contacttypes[contactType=" + contactType + "]";
    }

    public
    void addPropertyChangeListener(PropertyChangeListener listener)
    {
        changeSupport.addPropertyChangeListener(listener);
    }

    public
    void removePropertyChangeListener(PropertyChangeListener listener)
    {
        changeSupport.addPropertyChangeListener(listener);
    }

}
