/*
 * This is autogenerated and should not be modified.
 * Any changes should be made to the super class.
 * Copyright: (c) Reinders Posters
 * Modified:  $Date$
 */

package nl.reinders.bm.generated;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.beans.PropertyVetoException;
import java.beans.VetoableChangeListener;
import java.beans.VetoableChangeSupport;

import javax.persistence.EntityManager;
import javax.persistence.MappedSuperclass;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.SequenceGenerator;
import javax.persistence.TableGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.FetchType;
import javax.persistence.CascadeType;
import javax.persistence.JoinColumn;
import javax.persistence.Query;
import javax.persistence.Transient;

/**
 * A JPA entity class for v_sellstandignore.
 * @version    $Revision$
 * @author     $Author$
 */
@MappedSuperclass
abstract public class VSellstandignore extends nl.reinders.bm.AbstractBean
implements java.io.Serializable
         , java.lang.Cloneable
{
	static final long serialVersionUID = 0;
	static final String SOURCECODE_VERSION = "$Revision$";
	static org.apache.log4j.Logger log4j = org.apache.log4j.Logger.getLogger(VSellstandignore.class.getName());

	// ===============================================================================================
	// RELATIONS OneToMany


	// ===============================================================================================
	// RELATIONS ManyToOne



	// ===============================================================================================
	// PROPERTIES

	/** Relationnr */
	public Integer getRelationnr() { return iRelationnr; }
	public void setRelationnr(Integer value)
	{
		try
		{
			Integer lValue = iRelationnr;
			if (log4j.isDebugEnabled()) log4j.debug("setRelationnr: " + lValue + " -> " + value);
			fireVetoableChange(RELATIONNR_PROPERTY_ID, lValue, value);
			iRelationnr = value;
			firePropertyChange(RELATIONNR_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="relationnr")
	private Integer iRelationnr = null;
	final static public String RELATIONNR_PROPERTY_ID = "relationnr";
	final static public Class RELATIONNR_PROPERTY_CLASS = Integer.class;
	final static public String RELATIONNR_NAME = "Relationnr"; // with this ID you can access the internationalization

	/** Standversionnr */
	public Integer getStandversionnr() { return iStandversionnr; }
	public void setStandversionnr(Integer value)
	{
		try
		{
			Integer lValue = iStandversionnr;
			if (log4j.isDebugEnabled()) log4j.debug("setStandversionnr: " + lValue + " -> " + value);
			fireVetoableChange(STANDVERSIONNR_PROPERTY_ID, lValue, value);
			iStandversionnr = value;
			firePropertyChange(STANDVERSIONNR_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="standversionnr")
	private Integer iStandversionnr = null;
	final static public String STANDVERSIONNR_PROPERTY_ID = "standversionnr";
	final static public Class STANDVERSIONNR_PROPERTY_CLASS = Integer.class;
	final static public String STANDVERSIONNR_NAME = "Standversionnr"; // with this ID you can access the internationalization

	/** Code */
	public Integer getCode() { return iCode; }
	public void setCode(Integer value)
	{
		try
		{
			Integer lValue = iCode;
			if (log4j.isDebugEnabled()) log4j.debug("setCode: " + lValue + " -> " + value);
			fireVetoableChange(CODE_PROPERTY_ID, lValue, value);
			iCode = value;
			firePropertyChange(CODE_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="code")
	private Integer iCode = null;
	final static public String CODE_PROPERTY_ID = "code";
	final static public Class CODE_PROPERTY_CLASS = Integer.class;
	final static public String CODE_NAME = "Code"; // with this ID you can access the internationalization

	/** Dwhmodified */
	public java.util.Calendar getDwhmodified() { return iDwhmodified; }
	public void setDwhmodified(java.util.Calendar value)
	{
		try
		{
			java.util.Calendar lValue = iDwhmodified;
			if (log4j.isDebugEnabled()) log4j.debug("setDwhmodified: " + lValue + " -> " + value);
			fireVetoableChange(DWHMODIFIED_PROPERTY_ID, lValue, value);
			iDwhmodified = value;
			firePropertyChange(DWHMODIFIED_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Temporal(TemporalType.TIMESTAMP) @Column(name="dwhmodified")
	private java.util.Calendar iDwhmodified = new java.util.GregorianCalendar();
	final static public String DWHMODIFIED_PROPERTY_ID = "dwhmodified";
	final static public Class DWHMODIFIED_PROPERTY_CLASS = java.util.Calendar.class;
	final static public String DWHMODIFIED_NAME = "Dwhmodified"; // with this ID you can access the internationalization

	/** Dwhby */
	public Integer getDwhby() { return iDwhby; }
	public void setDwhby(Integer value)
	{
		try
		{
			Integer lValue = iDwhby;
			if (log4j.isDebugEnabled()) log4j.debug("setDwhby: " + lValue + " -> " + value);
			fireVetoableChange(DWHBY_PROPERTY_ID, lValue, value);
			iDwhby = value;
			firePropertyChange(DWHBY_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="dwhby")
	private Integer iDwhby = null;
	final static public String DWHBY_PROPERTY_ID = "dwhby";
	final static public Class DWHBY_PROPERTY_CLASS = Integer.class;
	final static public String DWHBY_NAME = "Dwhby"; // with this ID you can access the internationalization


	// ===============================================================================================
	// Clone

	/** clone */
	public Object clone()
	{ 
		nl.reinders.bm.VSellstandignore lNew = new nl.reinders.bm.VSellstandignore();
		lNew.setRelationnr( getRelationnr() ); 
		lNew.setStandversionnr( getStandversionnr() ); 
		lNew.setCode( getCode() ); 
		// not cloning this column: lNew.setDwhmodified( getDwhmodified() ); 
		// not cloning this column: lNew.setDwhby( getDwhby() ); 
		return lNew;
	}
	public nl.reinders.bm.VSellstandignore cloneShallow() { return (nl.reinders.bm.VSellstandignore)clone();}


	// =========================================================================================
	// DAO

	/**
	 */
	static public nl.reinders.bm.VSellstandignore findByPK()
	{
		EntityManager lEntityManager = org.tbee.util.jpa.EntityManagerFinder.findEntityManager();
		if (log4j.isDebugEnabled()) log4j.debug("Using EM #" + Integer.toHexString( lEntityManager.hashCode() ) );
		Query lQuery = lEntityManager.createQuery("select t from VSellstandignore t where ");
		java.util.List<nl.reinders.bm.VSellstandignore> lList = lQuery.getResultList();
	    if (lList.size() == 0) return null;
	    return lList.get(0);
	}

	/**
	 * find all entities
	 */
	static public java.util.List<nl.reinders.bm.VSellstandignore> findAll()
	{
		return findAllOrderedBy(null);
	}

	/**
	 * find all entities ordered by
	 */
	static public java.util.List<nl.reinders.bm.VSellstandignore> findAllOrderedBy(String orderedBy)
	{
		EntityManager lEntityManager = org.tbee.util.jpa.EntityManagerFinder.findEntityManager();
		if (log4j.isDebugEnabled()) log4j.debug("Using EM #" + Integer.toHexString( lEntityManager.hashCode() ) );
		Query lQuery = lEntityManager.createQuery("select t from VSellstandignore t" + (orderedBy == null ? "" : " order by t." + orderedBy) + "");
		java.util.List<nl.reinders.bm.VSellstandignore> lList = lQuery.getResultList();
	    return lList;
	}


	// =========================================================================================
	// EQUALS

	/**
	 *
	 */
	public boolean equals(Object o)
	{
		return super.equals(o);
	}



	// =========================================================================================
	// CONVIENIENCE

	/**
	 *
	 */
	public String toString()
	{
		StringBuffer lStringBuffer = new StringBuffer();
		lStringBuffer.append(super.toString());
		return lStringBuffer.toString();
	}


	/**
	 * Using the Internationalization class
	 */
	static public String translate(String id)
	{
		return org.tbee.util.Internationalization.getInternationalization().translate(nl.reinders.bm.VSellstandignore.class, id);
	}
}
