/*
 * 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 buyorder.
 * @version    $Revision$
 * @author     $Author$
 */
@MappedSuperclass
abstract public class Buyorder extends nl.reinders.bm.AbstractBean
implements java.io.Serializable
         , java.lang.Cloneable
         , Comparable<nl.reinders.bm.Buyorder>
{
	static final long serialVersionUID = 0;
	static final String SOURCECODE_VERSION = "$Revision$";
	static org.apache.log4j.Logger log4j = org.apache.log4j.Logger.getLogger(Buyorder.class.getName());

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

	/** Buyorder2StatussWhereIAmBuyorder*/
	public void addBuyorder2StatussWhereIAmBuyorder(nl.reinders.bm.Buyorder2Status value)
	{
		if (value != null && !iBuyorder2StatussWhereIAmBuyorder.contains(value))
		{
			iBuyorder2StatussWhereIAmBuyorder.add(value);
			value.setBuyorder( (nl.reinders.bm.Buyorder)this);
		}
	}
	public void removeBuyorder2StatussWhereIAmBuyorder(nl.reinders.bm.Buyorder2Status value)
	{
		if (value != null && iBuyorder2StatussWhereIAmBuyorder.contains(value))
		{
			iBuyorder2StatussWhereIAmBuyorder.remove(value);
			value.setBuyorder( (nl.reinders.bm.Buyorder)null );
		}
	}
	public java.util.List<nl.reinders.bm.Buyorder2Status> getBuyorder2StatussWhereIAmBuyorder() { return iBuyorder2StatussWhereIAmBuyorder; }
	@OneToMany(mappedBy = "iBuyorder", fetch = FetchType.LAZY, targetEntity = nl.reinders.bm.Buyorder2Status.class, cascade = {CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE} )
	private java.util.List<nl.reinders.bm.Buyorder2Status> iBuyorder2StatussWhereIAmBuyorder = new java.util.ArrayList<nl.reinders.bm.Buyorder2Status>();

	/** BuyorderlinesWhereIAmBuyorder*/
	public void addBuyorderlinesWhereIAmBuyorder(nl.reinders.bm.Buyorderline value)
	{
		if (value != null && !iBuyorderlinesWhereIAmBuyorder.contains(value))
		{
			iBuyorderlinesWhereIAmBuyorder.add(value);
			value.setBuyorder( (nl.reinders.bm.Buyorder)this);
		}
	}
	public void removeBuyorderlinesWhereIAmBuyorder(nl.reinders.bm.Buyorderline value)
	{
		if (value != null && iBuyorderlinesWhereIAmBuyorder.contains(value))
		{
			iBuyorderlinesWhereIAmBuyorder.remove(value);
			value.setBuyorder( (nl.reinders.bm.Buyorder)null );
		}
	}
	public java.util.List<nl.reinders.bm.Buyorderline> getBuyorderlinesWhereIAmBuyorder() { return iBuyorderlinesWhereIAmBuyorder; }
	@OneToMany(mappedBy = "iBuyorder", fetch = FetchType.LAZY, targetEntity = nl.reinders.bm.Buyorderline.class, cascade = {CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE} )
	private java.util.List<nl.reinders.bm.Buyorderline> iBuyorderlinesWhereIAmBuyorder = new java.util.ArrayList<nl.reinders.bm.Buyorderline>();

	/** Delivery2BuyordersWhereIAmBuyorder*/
	public void addDelivery2BuyordersWhereIAmBuyorder(nl.reinders.bm.Delivery2Buyorder value)
	{
		if (value != null && !iDelivery2BuyordersWhereIAmBuyorder.contains(value))
		{
			iDelivery2BuyordersWhereIAmBuyorder.add(value);
			value.setBuyorder( (nl.reinders.bm.Buyorder)this);
		}
	}
	public void removeDelivery2BuyordersWhereIAmBuyorder(nl.reinders.bm.Delivery2Buyorder value)
	{
		if (value != null && iDelivery2BuyordersWhereIAmBuyorder.contains(value))
		{
			iDelivery2BuyordersWhereIAmBuyorder.remove(value);
			value.setBuyorder( (nl.reinders.bm.Buyorder)null );
		}
	}
	public java.util.List<nl.reinders.bm.Delivery2Buyorder> getDelivery2BuyordersWhereIAmBuyorder() { return iDelivery2BuyordersWhereIAmBuyorder; }
	@OneToMany(mappedBy = "iBuyorder", fetch = FetchType.LAZY, targetEntity = nl.reinders.bm.Delivery2Buyorder.class, cascade = {CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE} )
	private java.util.List<nl.reinders.bm.Delivery2Buyorder> iDelivery2BuyordersWhereIAmBuyorder = new java.util.ArrayList<nl.reinders.bm.Delivery2Buyorder>();


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

	/** OrderAddress */
	public nl.reinders.bm.Address getOrderAddress() { return iOrderAddress; }
	public void setOrderAddress(nl.reinders.bm.Address value)
	{
		if (value == iOrderAddress) return; // optimalisation and prevent looping
		try
		{
			nl.reinders.bm.Address lValue = iOrderAddress;
			fireVetoableChange(ORDERADDRESS_PROPERTY_ID, lValue, value);
			if (lValue != null) lValue.removeBuyordersWhereIAmOrderAddress( (nl.reinders.bm.Buyorder)this );
			iOrderAddress = value;
			if (value != null) value.addBuyordersWhereIAmOrderAddress( (nl.reinders.bm.Buyorder)this );
			firePropertyChange(ORDERADDRESS_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@ManyToOne(fetch = FetchType.LAZY, targetEntity = nl.reinders.bm.Address.class, cascade = {CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE} ) @JoinColumn(name="order_addressnr") 
	private nl.reinders.bm.Address iOrderAddress;
	final static public String ORDERADDRESS_PROPERTY_ID = "orderAddress";
	final static public Class ORDERADDRESS_PROPERTY_CLASS = nl.reinders.bm.Address.class;
	final static public String ORDERADDRESS_NAME = "OrderAddress"; // with this ID you can access the internationalization
	// to make IN queryies possible
	@Column(name="order_addressnr", insertable=false, updatable=false)
	private java.math.BigDecimal iOrderAddressnr = null;

	/** DeliveryAddress */
	public nl.reinders.bm.Address getDeliveryAddress() { return iDeliveryAddress; }
	public void setDeliveryAddress(nl.reinders.bm.Address value)
	{
		if (value == iDeliveryAddress) return; // optimalisation and prevent looping
		try
		{
			nl.reinders.bm.Address lValue = iDeliveryAddress;
			fireVetoableChange(DELIVERYADDRESS_PROPERTY_ID, lValue, value);
			if (lValue != null) lValue.removeBuyordersWhereIAmDeliveryAddress( (nl.reinders.bm.Buyorder)this );
			iDeliveryAddress = value;
			if (value != null) value.addBuyordersWhereIAmDeliveryAddress( (nl.reinders.bm.Buyorder)this );
			firePropertyChange(DELIVERYADDRESS_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@ManyToOne(fetch = FetchType.LAZY, targetEntity = nl.reinders.bm.Address.class, cascade = {CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE} ) @JoinColumn(name="delivery_addressnr") 
	private nl.reinders.bm.Address iDeliveryAddress;
	final static public String DELIVERYADDRESS_PROPERTY_ID = "deliveryAddress";
	final static public Class DELIVERYADDRESS_PROPERTY_CLASS = nl.reinders.bm.Address.class;
	final static public String DELIVERYADDRESS_NAME = "DeliveryAddress"; // with this ID you can access the internationalization
	// to make IN queryies possible
	@Column(name="delivery_addressnr", insertable=false, updatable=false)
	private java.math.BigDecimal iDeliveryAddressnr = null;

	/** PickupAddress */
	public nl.reinders.bm.Address getPickupAddress() { return iPickupAddress; }
	public void setPickupAddress(nl.reinders.bm.Address value)
	{
		if (value == iPickupAddress) return; // optimalisation and prevent looping
		try
		{
			nl.reinders.bm.Address lValue = iPickupAddress;
			fireVetoableChange(PICKUPADDRESS_PROPERTY_ID, lValue, value);
			if (lValue != null) lValue.removeBuyordersWhereIAmPickupAddress( (nl.reinders.bm.Buyorder)this );
			iPickupAddress = value;
			if (value != null) value.addBuyordersWhereIAmPickupAddress( (nl.reinders.bm.Buyorder)this );
			firePropertyChange(PICKUPADDRESS_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@ManyToOne(fetch = FetchType.LAZY, targetEntity = nl.reinders.bm.Address.class, cascade = {CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE} ) @JoinColumn(name="pickup_addressnr") 
	private nl.reinders.bm.Address iPickupAddress;
	final static public String PICKUPADDRESS_PROPERTY_ID = "pickupAddress";
	final static public Class PICKUPADDRESS_PROPERTY_CLASS = nl.reinders.bm.Address.class;
	final static public String PICKUPADDRESS_NAME = "PickupAddress"; // with this ID you can access the internationalization
	// to make IN queryies possible
	@Column(name="pickup_addressnr", insertable=false, updatable=false)
	private java.math.BigDecimal iPickupAddressnr = null;

	/** Contact */
	public nl.reinders.bm.Contact getContact() { return iContact; }
	public void setContact(nl.reinders.bm.Contact value)
	{
		if (value == iContact) return; // optimalisation and prevent looping
		try
		{
			nl.reinders.bm.Contact lValue = iContact;
			fireVetoableChange(CONTACT_PROPERTY_ID, lValue, value);
			if (lValue != null) lValue.removeBuyordersWhereIAmContact( (nl.reinders.bm.Buyorder)this );
			iContact = value;
			if (value != null) value.addBuyordersWhereIAmContact( (nl.reinders.bm.Buyorder)this );
			firePropertyChange(CONTACT_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@ManyToOne(fetch = FetchType.LAZY, targetEntity = nl.reinders.bm.Contact.class, cascade = {CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE} ) @JoinColumn(name="contactnr") 
	private nl.reinders.bm.Contact iContact;
	final static public String CONTACT_PROPERTY_ID = "contact";
	final static public Class CONTACT_PROPERTY_CLASS = nl.reinders.bm.Contact.class;
	final static public String CONTACT_NAME = "Contact"; // with this ID you can access the internationalization
	// to make IN queryies possible
	@Column(name="contactnr", insertable=false, updatable=false)
	private java.math.BigDecimal iContactnr = null;

	/** Currency */
	public nl.reinders.bm.Currency getCurrency() { return iCurrency; }
	public void setCurrency(nl.reinders.bm.Currency value)
	{
		if (value == iCurrency) return; // optimalisation and prevent looping
		try
		{
			nl.reinders.bm.Currency lValue = iCurrency;
			fireVetoableChange(CURRENCY_PROPERTY_ID, lValue, value);
			if (lValue != null) lValue.removeBuyordersWhereIAmCurrency( (nl.reinders.bm.Buyorder)this );
			iCurrency = value;
			if (value != null) value.addBuyordersWhereIAmCurrency( (nl.reinders.bm.Buyorder)this );
			firePropertyChange(CURRENCY_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@ManyToOne(fetch = FetchType.LAZY, targetEntity = nl.reinders.bm.Currency.class, cascade = {CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE} ) @JoinColumn(name="currencynr") 
	private nl.reinders.bm.Currency iCurrency;
	final static public String CURRENCY_PROPERTY_ID = "currency";
	final static public Class CURRENCY_PROPERTY_CLASS = nl.reinders.bm.Currency.class;
	final static public String CURRENCY_NAME = "Currency"; // with this ID you can access the internationalization
	// to make IN queryies possible
	@Column(name="currencynr", insertable=false, updatable=false)
	private java.math.BigDecimal iCurrencynr = null;

	/** EnteredbyEmp */
	public nl.reinders.bm.Employee getEnteredbyEmp() { return iEnteredbyEmp; }
	public void setEnteredbyEmp(nl.reinders.bm.Employee value)
	{
		if (value == iEnteredbyEmp) return; // optimalisation and prevent looping
		try
		{
			nl.reinders.bm.Employee lValue = iEnteredbyEmp;
			fireVetoableChange(ENTEREDBYEMP_PROPERTY_ID, lValue, value);
			if (lValue != null) lValue.removeBuyordersWhereIAmEnteredbyEmp( (nl.reinders.bm.Buyorder)this );
			iEnteredbyEmp = value;
			if (value != null) value.addBuyordersWhereIAmEnteredbyEmp( (nl.reinders.bm.Buyorder)this );
			firePropertyChange(ENTEREDBYEMP_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@ManyToOne(fetch = FetchType.LAZY, targetEntity = nl.reinders.bm.Employee.class, cascade = {CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE} ) @JoinColumn(name="enteredby_empnr") 
	private nl.reinders.bm.Employee iEnteredbyEmp;
	final static public String ENTEREDBYEMP_PROPERTY_ID = "enteredbyEmp";
	final static public Class ENTEREDBYEMP_PROPERTY_CLASS = nl.reinders.bm.Employee.class;
	final static public String ENTEREDBYEMP_NAME = "EnteredbyEmp"; // with this ID you can access the internationalization
	// to make IN queryies possible
	@Column(name="enteredby_empnr", insertable=false, updatable=false)
	private java.math.BigDecimal iEnteredbyEmpnr = null;

	/** Relation */
	public nl.reinders.bm.Relation getRelation() { return iRelation; }
	public void setRelation(nl.reinders.bm.Relation value)
	{
		if (value == iRelation) return; // optimalisation and prevent looping
		try
		{
			nl.reinders.bm.Relation lValue = iRelation;
			fireVetoableChange(RELATION_PROPERTY_ID, lValue, value);
			if (lValue != null) lValue.removeBuyordersWhereIAmRelation( (nl.reinders.bm.Buyorder)this );
			iRelation = value;
			if (value != null) value.addBuyordersWhereIAmRelation( (nl.reinders.bm.Buyorder)this );
			firePropertyChange(RELATION_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@ManyToOne(fetch = FetchType.LAZY, targetEntity = nl.reinders.bm.Relation.class, cascade = {CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE} ) @JoinColumn(name="relationnr") 
	private nl.reinders.bm.Relation iRelation;
	final static public String RELATION_PROPERTY_ID = "relation";
	final static public Class RELATION_PROPERTY_CLASS = nl.reinders.bm.Relation.class;
	final static public String RELATION_NAME = "Relation"; // with this ID you can access the internationalization
	// to make IN queryies possible
	@Column(name="relationnr", insertable=false, updatable=false)
	private java.math.BigDecimal iRelationnr = null;

	/** DeliveryRelation */
	public nl.reinders.bm.Relation getDeliveryRelation() { return iDeliveryRelation; }
	public void setDeliveryRelation(nl.reinders.bm.Relation value)
	{
		if (value == iDeliveryRelation) return; // optimalisation and prevent looping
		try
		{
			nl.reinders.bm.Relation lValue = iDeliveryRelation;
			fireVetoableChange(DELIVERYRELATION_PROPERTY_ID, lValue, value);
			if (lValue != null) lValue.removeBuyordersWhereIAmDeliveryRelation( (nl.reinders.bm.Buyorder)this );
			iDeliveryRelation = value;
			if (value != null) value.addBuyordersWhereIAmDeliveryRelation( (nl.reinders.bm.Buyorder)this );
			firePropertyChange(DELIVERYRELATION_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@ManyToOne(fetch = FetchType.LAZY, targetEntity = nl.reinders.bm.Relation.class, cascade = {CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE} ) @JoinColumn(name="delivery_relationnr") 
	private nl.reinders.bm.Relation iDeliveryRelation;
	final static public String DELIVERYRELATION_PROPERTY_ID = "deliveryRelation";
	final static public Class DELIVERYRELATION_PROPERTY_CLASS = nl.reinders.bm.Relation.class;
	final static public String DELIVERYRELATION_NAME = "DeliveryRelation"; // with this ID you can access the internationalization
	// to make IN queryies possible
	@Column(name="delivery_relationnr", insertable=false, updatable=false)
	private java.math.BigDecimal iDeliveryRelationnr = null;



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

	/** Buyordernr */
	public Integer getBuyordernr() { return iBuyordernr; }
	public void setBuyordernr(Integer value)
	{
		try
		{
			Integer lValue = iBuyordernr;
			if (log4j.isDebugEnabled()) log4j.debug("setBuyordernr: " + lValue + " -> " + value);
			fireVetoableChange(BUYORDERNR_PROPERTY_ID, lValue, value);
			iBuyordernr = value;
			firePropertyChange(BUYORDERNR_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Id @GeneratedValue(generator="buyorder.buyordernr", strategy=GenerationType.TABLE) @TableGenerator( name="buyorder.buyordernr", pkColumnValue="buyordernr", table="sequence", pkColumnName="seq_name", valueColumnName="seq_count", initialValue=1, allocationSize=1) @Column(name="buyordernr")
	private Integer iBuyordernr = null;
	final static public String BUYORDERNR_PROPERTY_ID = "buyordernr";
	final static public Class BUYORDERNR_PROPERTY_CLASS = Integer.class;
	final static public String BUYORDERNR_NAME = "Buyordernr"; // with this ID you can access the internationalization

	/** Stage */
	public String getStage() { return iStage; }
	public void setStage(String value)
	{
		try
		{
			String lValue = iStage;
			if (log4j.isDebugEnabled()) log4j.debug("setStage: " + lValue + " -> " + value);
			fireVetoableChange(STAGE_PROPERTY_ID, lValue, value);
			iStage = value;
			firePropertyChange(STAGE_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="stage")
	private String iStage = null;
	final static public String STAGE_PROPERTY_ID = "stage";
	final static public Class STAGE_PROPERTY_CLASS = String.class;
	final static public String STAGE_NAME = "Stage"; // with this ID you can access the internationalization

	/** Buydate */
	public java.util.Calendar getBuydate() { return iBuydate; }
	public void setBuydate(java.util.Calendar value)
	{
		try
		{
			java.util.Calendar lValue = iBuydate;
			if (log4j.isDebugEnabled()) log4j.debug("setBuydate: " + lValue + " -> " + value);
			fireVetoableChange(BUYDATE_PROPERTY_ID, lValue, value);
			iBuydate = value;
			firePropertyChange(BUYDATE_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Temporal(TemporalType.TIMESTAMP) @Column(name="buydate")
	private java.util.Calendar iBuydate = null;
	final static public String BUYDATE_PROPERTY_ID = "buydate";
	final static public Class BUYDATE_PROPERTY_CLASS = java.util.Calendar.class;
	final static public String BUYDATE_NAME = "Buydate"; // with this ID you can access the internationalization

	/** Reason */
	public String getReason() { return iReason; }
	public void setReason(String value)
	{
		try
		{
			String lValue = iReason;
			if (log4j.isDebugEnabled()) log4j.debug("setReason: " + lValue + " -> " + value);
			fireVetoableChange(REASON_PROPERTY_ID, lValue, value);
			iReason = value;
			firePropertyChange(REASON_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="reason")
	private String iReason = null;
	final static public String REASON_PROPERTY_ID = "reason";
	final static public Class REASON_PROPERTY_CLASS = String.class;
	final static public String REASON_NAME = "Reason"; // with this ID you can access the internationalization

	/** Mededeling */
	public String getMededeling() { return iMededeling; }
	public void setMededeling(String value)
	{
		try
		{
			String lValue = iMededeling;
			if (log4j.isDebugEnabled()) log4j.debug("setMededeling: " + lValue + " -> " + value);
			fireVetoableChange(MEDEDELING_PROPERTY_ID, lValue, value);
			iMededeling = value;
			firePropertyChange(MEDEDELING_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="mededeling")
	private String iMededeling = null;
	final static public String MEDEDELING_PROPERTY_ID = "mededeling";
	final static public Class MEDEDELING_PROPERTY_CLASS = String.class;
	final static public String MEDEDELING_NAME = "Mededeling"; // with this ID you can access the internationalization

	/** DeliveryDate */
	public java.util.Calendar getDeliveryDate() { return iDeliveryDate; }
	public void setDeliveryDate(java.util.Calendar value)
	{
		try
		{
			java.util.Calendar lValue = iDeliveryDate;
			if (log4j.isDebugEnabled()) log4j.debug("setDeliveryDate: " + lValue + " -> " + value);
			fireVetoableChange(DELIVERYDATE_PROPERTY_ID, lValue, value);
			iDeliveryDate = value;
			firePropertyChange(DELIVERYDATE_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Temporal(TemporalType.TIMESTAMP) @Column(name="delivery_date")
	private java.util.Calendar iDeliveryDate = null;
	final static public String DELIVERYDATE_PROPERTY_ID = "deliveryDate";
	final static public Class DELIVERYDATE_PROPERTY_CLASS = java.util.Calendar.class;
	final static public String DELIVERYDATE_NAME = "DeliveryDate"; // with this ID you can access the internationalization

	/** Weight */
	public java.math.BigDecimal getWeight() { return iWeight; }
	public void setWeight(java.math.BigDecimal value)
	{
		try
		{
			java.math.BigDecimal lValue = iWeight;
			if (log4j.isDebugEnabled()) log4j.debug("setWeight: " + lValue + " -> " + value);
			fireVetoableChange(WEIGHT_PROPERTY_ID, lValue, value);
			iWeight = value;
			firePropertyChange(WEIGHT_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="weight")
	private java.math.BigDecimal iWeight = null;
	final static public String WEIGHT_PROPERTY_ID = "weight";
	final static public Class WEIGHT_PROPERTY_CLASS = java.math.BigDecimal.class;
	final static public String WEIGHT_NAME = "Weight"; // with this ID you can access the internationalization

	/** Lazylock */
	public Integer getLazylock() { return iLazylock; }
	public void setLazylock(Integer value)
	{
		try
		{
			Integer lValue = iLazylock;
			if (log4j.isDebugEnabled()) log4j.debug("setLazylock: " + lValue + " -> " + value);
			fireVetoableChange(LAZYLOCK_PROPERTY_ID, lValue, value);
			iLazylock = value;
			firePropertyChange(LAZYLOCK_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Version @Column(name="lazylock")
	private Integer iLazylock = 0;
	final static public String LAZYLOCK_PROPERTY_ID = "lazylock";
	final static public Class LAZYLOCK_PROPERTY_CLASS = Integer.class;
	final static public String LAZYLOCK_NAME = "Lazylock"; // with this ID you can access the internationalization

	/** Financialcomplete */
	public java.util.Calendar getFinancialcomplete() { return iFinancialcomplete; }
	public void setFinancialcomplete(java.util.Calendar value)
	{
		try
		{
			java.util.Calendar lValue = iFinancialcomplete;
			if (log4j.isDebugEnabled()) log4j.debug("setFinancialcomplete: " + lValue + " -> " + value);
			fireVetoableChange(FINANCIALCOMPLETE_PROPERTY_ID, lValue, value);
			iFinancialcomplete = value;
			firePropertyChange(FINANCIALCOMPLETE_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Temporal(TemporalType.TIMESTAMP) @Column(name="financialcomplete")
	private java.util.Calendar iFinancialcomplete = null;
	final static public String FINANCIALCOMPLETE_PROPERTY_ID = "financialcomplete";
	final static public Class FINANCIALCOMPLETE_PROPERTY_CLASS = java.util.Calendar.class;
	final static public String FINANCIALCOMPLETE_NAME = "Financialcomplete"; // with this ID you can access the internationalization

	/** Freightbill */
	public Integer getFreightbill() { return iFreightbill; }
	public void setFreightbill(Integer value)
	{
		try
		{
			Integer lValue = iFreightbill;
			if (log4j.isDebugEnabled()) log4j.debug("setFreightbill: " + lValue + " -> " + value);
			fireVetoableChange(FREIGHTBILL_PROPERTY_ID, lValue, value);
			iFreightbill = value;
			firePropertyChange(FREIGHTBILL_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="freightbill")
	private Integer iFreightbill = 0;
	final static public String FREIGHTBILL_PROPERTY_ID = "freightbill";
	final static public Class FREIGHTBILL_PROPERTY_CLASS = Integer.class;
	final static public String FREIGHTBILL_NAME = "Freightbill"; // with this ID you can access the internationalization

	/** Bill */
	public Integer getBill() { return iBill; }
	public void setBill(Integer value)
	{
		try
		{
			Integer lValue = iBill;
			if (log4j.isDebugEnabled()) log4j.debug("setBill: " + lValue + " -> " + value);
			fireVetoableChange(BILL_PROPERTY_ID, lValue, value);
			iBill = value;
			firePropertyChange(BILL_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="bill")
	private Integer iBill = 0;
	final static public String BILL_PROPERTY_ID = "bill";
	final static public Class BILL_PROPERTY_CLASS = Integer.class;
	final static public String BILL_NAME = "Bill"; // with this ID you can access the internationalization

	/** Freightletter */
	public Integer getFreightletter() { return iFreightletter; }
	public void setFreightletter(Integer value)
	{
		try
		{
			Integer lValue = iFreightletter;
			if (log4j.isDebugEnabled()) log4j.debug("setFreightletter: " + lValue + " -> " + value);
			fireVetoableChange(FREIGHTLETTER_PROPERTY_ID, lValue, value);
			iFreightletter = value;
			firePropertyChange(FREIGHTLETTER_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="freightletter")
	private Integer iFreightletter = 0;
	final static public String FREIGHTLETTER_PROPERTY_ID = "freightletter";
	final static public Class FREIGHTLETTER_PROPERTY_CLASS = Integer.class;
	final static public String FREIGHTLETTER_NAME = "Freightletter"; // with this ID you can access the internationalization

	/** Freightmoney */
	public java.math.BigDecimal getFreightmoney() { return iFreightmoney; }
	public void setFreightmoney(java.math.BigDecimal value)
	{
		try
		{
			java.math.BigDecimal lValue = iFreightmoney;
			if (log4j.isDebugEnabled()) log4j.debug("setFreightmoney: " + lValue + " -> " + value);
			fireVetoableChange(FREIGHTMONEY_PROPERTY_ID, lValue, value);
			iFreightmoney = value;
			firePropertyChange(FREIGHTMONEY_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="freightmoney")
	private java.math.BigDecimal iFreightmoney = null;
	final static public String FREIGHTMONEY_PROPERTY_ID = "freightmoney";
	final static public Class FREIGHTMONEY_PROPERTY_CLASS = java.math.BigDecimal.class;
	final static public String FREIGHTMONEY_NAME = "Freightmoney"; // 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

	/** TransportRelationnr */
	public Integer getTransportRelationnr() { return iTransportRelationnr; }
	public void setTransportRelationnr(Integer value)
	{
		try
		{
			Integer lValue = iTransportRelationnr;
			if (log4j.isDebugEnabled()) log4j.debug("setTransportRelationnr: " + lValue + " -> " + value);
			fireVetoableChange(TRANSPORTRELATIONNR_PROPERTY_ID, lValue, value);
			iTransportRelationnr = value;
			firePropertyChange(TRANSPORTRELATIONNR_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="transport_relationnr")
	private Integer iTransportRelationnr = null;
	final static public String TRANSPORTRELATIONNR_PROPERTY_ID = "transportRelationnr";
	final static public Class TRANSPORTRELATIONNR_PROPERTY_CLASS = Integer.class;
	final static public String TRANSPORTRELATIONNR_NAME = "TransportRelationnr"; // with this ID you can access the internationalization

	/** Packaging */
	public String getPackaging() { return iPackaging; }
	public void setPackaging(String value)
	{
		try
		{
			String lValue = iPackaging;
			if (log4j.isDebugEnabled()) log4j.debug("setPackaging: " + lValue + " -> " + value);
			fireVetoableChange(PACKAGING_PROPERTY_ID, lValue, value);
			iPackaging = value;
			firePropertyChange(PACKAGING_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="packaging")
	private String iPackaging = null;
	final static public String PACKAGING_PROPERTY_ID = "packaging";
	final static public Class PACKAGING_PROPERTY_CLASS = String.class;
	final static public String PACKAGING_NAME = "Packaging"; // with this ID you can access the internationalization

	/** Inserted */
	public java.util.Calendar getInserted() { return iInserted; }
	public void setInserted(java.util.Calendar value)
	{
		try
		{
			java.util.Calendar lValue = iInserted;
			if (log4j.isDebugEnabled()) log4j.debug("setInserted: " + lValue + " -> " + value);
			fireVetoableChange(INSERTED_PROPERTY_ID, lValue, value);
			iInserted = value;
			firePropertyChange(INSERTED_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Temporal(TemporalType.TIMESTAMP) @Column(name="inserted")
	private java.util.Calendar iInserted = new java.util.GregorianCalendar();
	final static public String INSERTED_PROPERTY_ID = "inserted";
	final static public Class INSERTED_PROPERTY_CLASS = java.util.Calendar.class;
	final static public String INSERTED_NAME = "Inserted"; // with this ID you can access the internationalization


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

	/** clone */
	public Object clone()
	{ 
		nl.reinders.bm.Buyorder lNew = new nl.reinders.bm.Buyorder();
		lNew.setOrderAddress( getOrderAddress() ); 
		lNew.setDeliveryAddress( getDeliveryAddress() ); 
		lNew.setPickupAddress( getPickupAddress() ); 
		lNew.setContact( getContact() ); 
		lNew.setCurrency( getCurrency() ); 
		lNew.setEnteredbyEmp( getEnteredbyEmp() ); 
		lNew.setRelation( getRelation() ); 
		lNew.setDeliveryRelation( getDeliveryRelation() ); 
		lNew.setStage( getStage() ); 
		lNew.setBuydate( getBuydate() ); 
		lNew.setReason( getReason() ); 
		lNew.setMededeling( getMededeling() ); 
		lNew.setDeliveryDate( getDeliveryDate() ); 
		lNew.setWeight( getWeight() ); 
		lNew.setFinancialcomplete( getFinancialcomplete() ); 
		lNew.setFreightbill( getFreightbill() ); 
		lNew.setBill( getBill() ); 
		lNew.setFreightletter( getFreightletter() ); 
		lNew.setFreightmoney( getFreightmoney() ); 
		// not cloning this column: lNew.setDwhmodified( getDwhmodified() ); 
		// not cloning this column: lNew.setDwhby( getDwhby() ); 
		lNew.setTransportRelationnr( getTransportRelationnr() ); 
		lNew.setPackaging( getPackaging() ); 
		lNew.setInserted( getInserted() ); 
		return lNew;
	}
	public nl.reinders.bm.Buyorder cloneShallow() { return (nl.reinders.bm.Buyorder)clone();}


	// =========================================================================================
	// Comparable

	/**
	 * default compare on primary key
	 */
	public int compareTo(nl.reinders.bm.Buyorder o)
	{
		if (this.getBuyordernr() == null) return -1;
		if (o == null) return 1;
		return this.getBuyordernr().compareTo( o.getBuyordernr() );
	}


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

	/**
	 * @param buyordernr
	 */
	static public nl.reinders.bm.Buyorder findByPK(Integer buyordernr)
	{
		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 Buyorder t where t.iBuyordernr=:buyordernr");
		lQuery.setParameter("buyordernr", buyordernr);
		java.util.List<nl.reinders.bm.Buyorder> lList = lQuery.getResultList();
	    if (lList.size() == 0) return null;
	    return lList.get(0);
	}

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

	/**
	 * find all entities ordered by
	 */
	static public java.util.List<nl.reinders.bm.Buyorder> 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 Buyorder t" + (orderedBy == null ? "" : " order by t." + orderedBy) + "");
		java.util.List<nl.reinders.bm.Buyorder> lList = lQuery.getResultList();
	    return lList;
	}


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

	/**
	 *
	 */
	public boolean equals(Object o)
	{
		if (o == null) return false;
		if (!(o instanceof nl.reinders.bm.Buyorder)) return false;
		nl.reinders.bm.Buyorder lOther = (nl.reinders.bm.Buyorder)o;
		if (
			this.getBuyordernr() != null && lOther.getBuyordernr() != null
		)
		{
			return
				   this.getBuyordernr().equals( lOther.getBuyordernr() )
			;
		}
		else
			return super.equals(o);
	}



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

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


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