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

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

	/** BatchsellorderlinesWhereIAmSellorderline*/
	public void addBatchsellorderlinesWhereIAmSellorderline(nl.reinders.bm.Batchsellorderline value)
	{
		if (value != null && !iBatchsellorderlinesWhereIAmSellorderline.contains(value))
		{
			iBatchsellorderlinesWhereIAmSellorderline.add(value);
			value.setSellorderline( (nl.reinders.bm.Sellorderline)this);
		}
	}
	public void removeBatchsellorderlinesWhereIAmSellorderline(nl.reinders.bm.Batchsellorderline value)
	{
		if (value != null && iBatchsellorderlinesWhereIAmSellorderline.contains(value))
		{
			iBatchsellorderlinesWhereIAmSellorderline.remove(value);
			value.setSellorderline( (nl.reinders.bm.Sellorderline)null );
		}
	}
	public java.util.List<nl.reinders.bm.Batchsellorderline> getBatchsellorderlinesWhereIAmSellorderline() { return iBatchsellorderlinesWhereIAmSellorderline; }
	@OneToMany(mappedBy = "iSellorderline", fetch = FetchType.LAZY, targetEntity = nl.reinders.bm.Batchsellorderline.class, cascade = {CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE} )
	private java.util.List<nl.reinders.bm.Batchsellorderline> iBatchsellorderlinesWhereIAmSellorderline = new java.util.ArrayList<nl.reinders.bm.Batchsellorderline>();

	/** ReservationsWhereIAmSellorderline*/
	public void addReservationsWhereIAmSellorderline(nl.reinders.bm.Reservation value)
	{
		if (value != null && !iReservationsWhereIAmSellorderline.contains(value))
		{
			iReservationsWhereIAmSellorderline.add(value);
			value.setSellorderline( (nl.reinders.bm.Sellorderline)this);
		}
	}
	public void removeReservationsWhereIAmSellorderline(nl.reinders.bm.Reservation value)
	{
		if (value != null && iReservationsWhereIAmSellorderline.contains(value))
		{
			iReservationsWhereIAmSellorderline.remove(value);
			value.setSellorderline( (nl.reinders.bm.Sellorderline)null );
		}
	}
	public java.util.List<nl.reinders.bm.Reservation> getReservationsWhereIAmSellorderline() { return iReservationsWhereIAmSellorderline; }
	@OneToMany(mappedBy = "iSellorderline", fetch = FetchType.LAZY, targetEntity = nl.reinders.bm.Reservation.class, cascade = {CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE} )
	private java.util.List<nl.reinders.bm.Reservation> iReservationsWhereIAmSellorderline = new java.util.ArrayList<nl.reinders.bm.Reservation>();

	/** SellorderlinesWhereIAmBackordSellline*/
	public void addSellorderlinesWhereIAmBackordSellline(nl.reinders.bm.Sellorderline value)
	{
		if (value != null && !iSellorderlinesWhereIAmBackordSellline.contains(value))
		{
			iSellorderlinesWhereIAmBackordSellline.add(value);
			value.setBackordSellline( (nl.reinders.bm.Sellorderline)this);
		}
	}
	public void removeSellorderlinesWhereIAmBackordSellline(nl.reinders.bm.Sellorderline value)
	{
		if (value != null && iSellorderlinesWhereIAmBackordSellline.contains(value))
		{
			iSellorderlinesWhereIAmBackordSellline.remove(value);
			value.setBackordSellline( (nl.reinders.bm.Sellorderline)null );
		}
	}
	public java.util.List<nl.reinders.bm.Sellorderline> getSellorderlinesWhereIAmBackordSellline() { return iSellorderlinesWhereIAmBackordSellline; }
	@OneToMany(mappedBy = "iBackordSellline", fetch = FetchType.LAZY, targetEntity = nl.reinders.bm.Sellorderline.class, cascade = {CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE} )
	private java.util.List<nl.reinders.bm.Sellorderline> iSellorderlinesWhereIAmBackordSellline = new java.util.ArrayList<nl.reinders.bm.Sellorderline>();


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

	/** Article */
	public nl.reinders.bm.Article getArticle() { return iArticle; }
	public void setArticle(nl.reinders.bm.Article value)
	{
		if (value == iArticle) return; // optimalisation and prevent looping
		try
		{
			nl.reinders.bm.Article lValue = iArticle;
			fireVetoableChange(ARTICLE_PROPERTY_ID, lValue, value);
			if (lValue != null) lValue.removeSellorderlinesWhereIAmArticle( (nl.reinders.bm.Sellorderline)this );
			iArticle = value;
			if (value != null) value.addSellorderlinesWhereIAmArticle( (nl.reinders.bm.Sellorderline)this );
			firePropertyChange(ARTICLE_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.Article.class, cascade = {CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE} ) @JoinColumn(name="articlenr") 
	private nl.reinders.bm.Article iArticle;
	final static public String ARTICLE_PROPERTY_ID = "article";
	final static public Class ARTICLE_PROPERTY_CLASS = nl.reinders.bm.Article.class;
	final static public String ARTICLE_NAME = "Article"; // with this ID you can access the internationalization
	// to make IN queryies possible
	@Column(name="articlenr", insertable=false, updatable=false)
	private java.math.BigDecimal iArticlenr = null;

	/** Batchtype */
	public nl.reinders.bm.Batchtype getBatchtype() { return iBatchtype; }
	public void setBatchtype(nl.reinders.bm.Batchtype value)
	{
		if (value == iBatchtype) return; // optimalisation and prevent looping
		try
		{
			nl.reinders.bm.Batchtype lValue = iBatchtype;
			fireVetoableChange(BATCHTYPE_PROPERTY_ID, lValue, value);
			if (lValue != null) lValue.removeSellorderlinesWhereIAmBatchtype( (nl.reinders.bm.Sellorderline)this );
			iBatchtype = value;
			if (value != null) value.addSellorderlinesWhereIAmBatchtype( (nl.reinders.bm.Sellorderline)this );
			firePropertyChange(BATCHTYPE_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.Batchtype.class, cascade = {CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE} ) @JoinColumn(name="batchtype") 
	private nl.reinders.bm.Batchtype iBatchtype;
	final static public String BATCHTYPE_PROPERTY_ID = "batchtype";
	final static public Class BATCHTYPE_PROPERTY_CLASS = nl.reinders.bm.Batchtype.class;
	final static public String BATCHTYPE_NAME = "Batchtype"; // with this ID you can access the internationalization
	// to make IN queryies possible
	@Column(name="batchtype", insertable=false, updatable=false)
	private java.math.BigDecimal iBatchtypenr = null;

	/** Sellorder */
	public nl.reinders.bm.Sellorder getSellorder() { return iSellorder; }
	public void setSellorder(nl.reinders.bm.Sellorder value)
	{
		if (value == iSellorder) return; // optimalisation and prevent looping
		try
		{
			nl.reinders.bm.Sellorder lValue = iSellorder;
			fireVetoableChange(SELLORDER_PROPERTY_ID, lValue, value);
			if (lValue != null) lValue.removeSellorderlinesWhereIAmSellorder( (nl.reinders.bm.Sellorderline)this );
			iSellorder = value;
			if (value != null) value.addSellorderlinesWhereIAmSellorder( (nl.reinders.bm.Sellorderline)this );
			firePropertyChange(SELLORDER_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.Sellorder.class, cascade = {CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE} ) @JoinColumn(name="sellordernr") 
	private nl.reinders.bm.Sellorder iSellorder;
	final static public String SELLORDER_PROPERTY_ID = "sellorder";
	final static public Class SELLORDER_PROPERTY_CLASS = nl.reinders.bm.Sellorder.class;
	final static public String SELLORDER_NAME = "Sellorder"; // with this ID you can access the internationalization
	// to make IN queryies possible
	@Column(name="sellordernr", insertable=false, updatable=false)
	private java.math.BigDecimal iSellordernr = null;

	/** BackordSellline */
	public nl.reinders.bm.Sellorderline getBackordSellline() { return iBackordSellline; }
	public void setBackordSellline(nl.reinders.bm.Sellorderline value)
	{
		if (value == iBackordSellline) return; // optimalisation and prevent looping
		try
		{
			nl.reinders.bm.Sellorderline lValue = iBackordSellline;
			fireVetoableChange(BACKORDSELLLINE_PROPERTY_ID, lValue, value);
			if (lValue != null) lValue.removeSellorderlinesWhereIAmBackordSellline( (nl.reinders.bm.Sellorderline)this );
			iBackordSellline = value;
			if (value != null) value.addSellorderlinesWhereIAmBackordSellline( (nl.reinders.bm.Sellorderline)this );
			firePropertyChange(BACKORDSELLLINE_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.Sellorderline.class, cascade = {CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE} ) @JoinColumn(name="backord_selllinenr") 
	private nl.reinders.bm.Sellorderline iBackordSellline;
	final static public String BACKORDSELLLINE_PROPERTY_ID = "backordSellline";
	final static public Class BACKORDSELLLINE_PROPERTY_CLASS = nl.reinders.bm.Sellorderline.class;
	final static public String BACKORDSELLLINE_NAME = "BackordSellline"; // with this ID you can access the internationalization
	// to make IN queryies possible
	@Column(name="backord_selllinenr", insertable=false, updatable=false)
	private java.math.BigDecimal iBackordSelllinenr = null;

	/** Standversion */
	public nl.reinders.bm.Standversion getStandversion() { return iStandversion; }
	public void setStandversion(nl.reinders.bm.Standversion value)
	{
		if (value == iStandversion) return; // optimalisation and prevent looping
		try
		{
			nl.reinders.bm.Standversion lValue = iStandversion;
			fireVetoableChange(STANDVERSION_PROPERTY_ID, lValue, value);
			if (lValue != null) lValue.removeSellorderlinesWhereIAmStandversion( (nl.reinders.bm.Sellorderline)this );
			iStandversion = value;
			if (value != null) value.addSellorderlinesWhereIAmStandversion( (nl.reinders.bm.Sellorderline)this );
			firePropertyChange(STANDVERSION_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.Standversion.class, cascade = {CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE} ) @JoinColumn(name="standversionnr") 
	private nl.reinders.bm.Standversion iStandversion;
	final static public String STANDVERSION_PROPERTY_ID = "standversion";
	final static public Class STANDVERSION_PROPERTY_CLASS = nl.reinders.bm.Standversion.class;
	final static public String STANDVERSION_NAME = "Standversion"; // with this ID you can access the internationalization
	// to make IN queryies possible
	@Column(name="standversionnr", insertable=false, updatable=false)
	private java.math.BigDecimal iStandversionnr = null;



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

	/** Sellorderlinenr */
	public Integer getSellorderlinenr() { return iSellorderlinenr; }
	public void setSellorderlinenr(Integer value)
	{
		try
		{
			Integer lValue = iSellorderlinenr;
			if (log4j.isDebugEnabled()) log4j.debug("setSellorderlinenr: " + lValue + " -> " + value);
			fireVetoableChange(SELLORDERLINENR_PROPERTY_ID, lValue, value);
			iSellorderlinenr = value;
			firePropertyChange(SELLORDERLINENR_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Id @GeneratedValue(generator="sellorderline.sellorderlinenr", strategy=GenerationType.TABLE) @TableGenerator( name="sellorderline.sellorderlinenr", pkColumnValue="sellorderlinenr", table="sequence", pkColumnName="seq_name", valueColumnName="seq_count", initialValue=1, allocationSize=25) @Column(name="sellorderlinenr")
	private Integer iSellorderlinenr = null;
	final static public String SELLORDERLINENR_PROPERTY_ID = "sellorderlinenr";
	final static public Class SELLORDERLINENR_PROPERTY_CLASS = Integer.class;
	final static public String SELLORDERLINENR_NAME = "Sellorderlinenr"; // with this ID you can access the internationalization

	/** Seqnr */
	public Integer getSeqnr() { return iSeqnr; }
	public void setSeqnr(Integer value)
	{
		try
		{
			Integer lValue = iSeqnr;
			if (log4j.isDebugEnabled()) log4j.debug("setSeqnr: " + lValue + " -> " + value);
			fireVetoableChange(SEQNR_PROPERTY_ID, lValue, value);
			iSeqnr = value;
			firePropertyChange(SEQNR_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="seqnr")
	private Integer iSeqnr = null;
	final static public String SEQNR_PROPERTY_ID = "seqnr";
	final static public Class SEQNR_PROPERTY_CLASS = Integer.class;
	final static public String SEQNR_NAME = "Seqnr"; // with this ID you can access the internationalization

	/** BackorderAmount */
	public Integer getBackorderAmount() { return iBackorderAmount; }
	public void setBackorderAmount(Integer value)
	{
		try
		{
			Integer lValue = iBackorderAmount;
			if (log4j.isDebugEnabled()) log4j.debug("setBackorderAmount: " + lValue + " -> " + value);
			fireVetoableChange(BACKORDERAMOUNT_PROPERTY_ID, lValue, value);
			iBackorderAmount = value;
			firePropertyChange(BACKORDERAMOUNT_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="backorder_amount")
	private Integer iBackorderAmount = 0;
	final static public String BACKORDERAMOUNT_PROPERTY_ID = "backorderAmount";
	final static public Class BACKORDERAMOUNT_PROPERTY_CLASS = Integer.class;
	final static public String BACKORDERAMOUNT_NAME = "BackorderAmount"; // with this ID you can access the internationalization

	/** PricePerUnit */
	public java.math.BigDecimal getPricePerUnit() { return iPricePerUnit; }
	public void setPricePerUnit(java.math.BigDecimal value)
	{
		try
		{
			java.math.BigDecimal lValue = iPricePerUnit;
			if (log4j.isDebugEnabled()) log4j.debug("setPricePerUnit: " + lValue + " -> " + value);
			fireVetoableChange(PRICEPERUNIT_PROPERTY_ID, lValue, value);
			iPricePerUnit = value;
			firePropertyChange(PRICEPERUNIT_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="price_per_unit")
	private java.math.BigDecimal iPricePerUnit = null;
	final static public String PRICEPERUNIT_PROPERTY_ID = "pricePerUnit";
	final static public Class PRICEPERUNIT_PROPERTY_CLASS = java.math.BigDecimal.class;
	final static public String PRICEPERUNIT_NAME = "PricePerUnit"; // with this ID you can access the internationalization

	/** Reduction */
	public java.math.BigDecimal getReduction() { return iReduction; }
	public void setReduction(java.math.BigDecimal value)
	{
		try
		{
			java.math.BigDecimal lValue = iReduction;
			if (log4j.isDebugEnabled()) log4j.debug("setReduction: " + lValue + " -> " + value);
			fireVetoableChange(REDUCTION_PROPERTY_ID, lValue, value);
			iReduction = value;
			firePropertyChange(REDUCTION_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="reduction")
	private java.math.BigDecimal iReduction = new java.math.BigDecimal("0.0000000000000000");
	final static public String REDUCTION_PROPERTY_ID = "reduction";
	final static public Class REDUCTION_PROPERTY_CLASS = java.math.BigDecimal.class;
	final static public String REDUCTION_NAME = "Reduction"; // with this ID you can access the internationalization

	/** Comment */
	public String getComment() { return iComment; }
	public void setComment(String value)
	{
		try
		{
			String lValue = iComment;
			if (log4j.isDebugEnabled()) log4j.debug("setComment: " + lValue + " -> " + value);
			fireVetoableChange(COMMENT_PROPERTY_ID, lValue, value);
			iComment = value;
			firePropertyChange(COMMENT_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="comment")
	private String iComment = null;
	final static public String COMMENT_PROPERTY_ID = "comment";
	final static public Class COMMENT_PROPERTY_CLASS = String.class;
	final static public String COMMENT_NAME = "Comment"; // 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

	/** Unmanagedamount */
	public Integer getUnmanagedamount() { return iUnmanagedamount; }
	public void setUnmanagedamount(Integer value)
	{
		try
		{
			Integer lValue = iUnmanagedamount;
			if (log4j.isDebugEnabled()) log4j.debug("setUnmanagedamount: " + lValue + " -> " + value);
			fireVetoableChange(UNMANAGEDAMOUNT_PROPERTY_ID, lValue, value);
			iUnmanagedamount = value;
			firePropertyChange(UNMANAGEDAMOUNT_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="unmanagedamount")
	private Integer iUnmanagedamount = 0;
	final static public String UNMANAGEDAMOUNT_PROPERTY_ID = "unmanagedamount";
	final static public Class UNMANAGEDAMOUNT_PROPERTY_CLASS = Integer.class;
	final static public String UNMANAGEDAMOUNT_NAME = "Unmanagedamount"; // with this ID you can access the internationalization

	/** Amount */
	public Integer getAmount() { return iAmount; }
	public void setAmount(Integer value)
	{
		try
		{
			Integer lValue = iAmount;
			if (log4j.isDebugEnabled()) log4j.debug("setAmount: " + lValue + " -> " + value);
			fireVetoableChange(AMOUNT_PROPERTY_ID, lValue, value);
			iAmount = value;
			firePropertyChange(AMOUNT_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="_amount")
	private Integer iAmount = 0;
	final static public String AMOUNT_PROPERTY_ID = "amount";
	final static public Class AMOUNT_PROPERTY_CLASS = Integer.class;
	final static public String AMOUNT_NAME = "Amount"; // with this ID you can access the internationalization

	/** Orderby */
	public java.math.BigDecimal getOrderby() { return iOrderby; }
	public void setOrderby(java.math.BigDecimal value)
	{
		try
		{
			java.math.BigDecimal lValue = iOrderby;
			if (log4j.isDebugEnabled()) log4j.debug("setOrderby: " + lValue + " -> " + value);
			fireVetoableChange(ORDERBY_PROPERTY_ID, lValue, value);
			iOrderby = value;
			firePropertyChange(ORDERBY_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="_orderby")
	private java.math.BigDecimal iOrderby = null;
	final static public String ORDERBY_PROPERTY_ID = "orderby";
	final static public Class ORDERBY_PROPERTY_CLASS = java.math.BigDecimal.class;
	final static public String ORDERBY_NAME = "Orderby"; // with this ID you can access the internationalization

	/** Unbookableamount */
	public Integer getUnbookableamount() { return iUnbookableamount; }
	public void setUnbookableamount(Integer value)
	{
		try
		{
			Integer lValue = iUnbookableamount;
			if (log4j.isDebugEnabled()) log4j.debug("setUnbookableamount: " + lValue + " -> " + value);
			fireVetoableChange(UNBOOKABLEAMOUNT_PROPERTY_ID, lValue, value);
			iUnbookableamount = value;
			firePropertyChange(UNBOOKABLEAMOUNT_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="unbookableamount")
	private Integer iUnbookableamount = 0;
	final static public String UNBOOKABLEAMOUNT_PROPERTY_ID = "unbookableamount";
	final static public Class UNBOOKABLEAMOUNT_PROPERTY_CLASS = Integer.class;
	final static public String UNBOOKABLEAMOUNT_NAME = "Unbookableamount"; // with this ID you can access the internationalization

	/** Managestock */
	public Integer getManagestock() { return iManagestock; }
	public void setManagestock(Integer value)
	{
		try
		{
			Integer lValue = iManagestock;
			if (log4j.isDebugEnabled()) log4j.debug("setManagestock: " + lValue + " -> " + value);
			fireVetoableChange(MANAGESTOCK_PROPERTY_ID, lValue, value);
			iManagestock = value;
			firePropertyChange(MANAGESTOCK_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="managestock")
	private Integer iManagestock = null;
	final static public String MANAGESTOCK_PROPERTY_ID = "managestock";
	final static public Class MANAGESTOCK_PROPERTY_CLASS = Integer.class;
	final static public String MANAGESTOCK_NAME = "Managestock"; // 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.Sellorderline lNew = new nl.reinders.bm.Sellorderline();
		lNew.setArticle( getArticle() ); 
		lNew.setBatchtype( getBatchtype() ); 
		lNew.setSellorder( getSellorder() ); 
		lNew.setBackordSellline( getBackordSellline() ); 
		lNew.setStandversion( getStandversion() ); 
		lNew.setSeqnr( getSeqnr() ); 
		lNew.setBackorderAmount( getBackorderAmount() ); 
		lNew.setPricePerUnit( getPricePerUnit() ); 
		lNew.setReduction( getReduction() ); 
		lNew.setComment( getComment() ); 
		lNew.setUnmanagedamount( getUnmanagedamount() ); 
		lNew.setAmount( getAmount() ); 
		lNew.setOrderby( getOrderby() ); 
		lNew.setUnbookableamount( getUnbookableamount() ); 
		lNew.setManagestock( getManagestock() ); 
		// not cloning this column: lNew.setDwhmodified( getDwhmodified() ); 
		// not cloning this column: lNew.setDwhby( getDwhby() ); 
		return lNew;
	}
	public nl.reinders.bm.Sellorderline cloneShallow() { return (nl.reinders.bm.Sellorderline)clone();}


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

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


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

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

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

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


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

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



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

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


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