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

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

	/** ContractpaymentsWhereIAmContract*/
	public void addContractpaymentsWhereIAmContract(nl.reinders.bm.Contractpayment value)
	{
		if (value != null && !iContractpaymentsWhereIAmContract.contains(value))
		{
			iContractpaymentsWhereIAmContract.add(value);
			value.setContract( (nl.reinders.bm.Contract)this);
		}
	}
	public void removeContractpaymentsWhereIAmContract(nl.reinders.bm.Contractpayment value)
	{
		if (value != null && iContractpaymentsWhereIAmContract.contains(value))
		{
			iContractpaymentsWhereIAmContract.remove(value);
			value.setContract( (nl.reinders.bm.Contract)null );
		}
	}
	public java.util.List<nl.reinders.bm.Contractpayment> getContractpaymentsWhereIAmContract() { return iContractpaymentsWhereIAmContract; }
	@OneToMany(mappedBy = "iContract", fetch = FetchType.LAZY, targetEntity = nl.reinders.bm.Contractpayment.class, cascade = {CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE} )
	private java.util.List<nl.reinders.bm.Contractpayment> iContractpaymentsWhereIAmContract = new java.util.ArrayList<nl.reinders.bm.Contractpayment>();

	/** Producttype2ContractsWhereIAmContract*/
	public void addProducttype2ContractsWhereIAmContract(nl.reinders.bm.Producttype2Contract value)
	{
		if (value != null && !iProducttype2ContractsWhereIAmContract.contains(value))
		{
			iProducttype2ContractsWhereIAmContract.add(value);
			value.setContract( (nl.reinders.bm.Contract)this);
		}
	}
	public void removeProducttype2ContractsWhereIAmContract(nl.reinders.bm.Producttype2Contract value)
	{
		if (value != null && iProducttype2ContractsWhereIAmContract.contains(value))
		{
			iProducttype2ContractsWhereIAmContract.remove(value);
			value.setContract( (nl.reinders.bm.Contract)null );
		}
	}
	public java.util.List<nl.reinders.bm.Producttype2Contract> getProducttype2ContractsWhereIAmContract() { return iProducttype2ContractsWhereIAmContract; }
	@OneToMany(mappedBy = "iContract", fetch = FetchType.LAZY, targetEntity = nl.reinders.bm.Producttype2Contract.class, cascade = {CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE} )
	private java.util.List<nl.reinders.bm.Producttype2Contract> iProducttype2ContractsWhereIAmContract = new java.util.ArrayList<nl.reinders.bm.Producttype2Contract>();


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

	/** Licensorid */
	public nl.reinders.bm.Relation getLicensorid() { return iLicensorid; }
	public void setLicensorid(nl.reinders.bm.Relation value)
	{
		if (value == iLicensorid) return; // optimalisation and prevent looping
		try
		{
			nl.reinders.bm.Relation lValue = iLicensorid;
			fireVetoableChange(LICENSORID_PROPERTY_ID, lValue, value);
			if (lValue != null) lValue.removeContractsWhereIAmLicensorid( (nl.reinders.bm.Contract)this );
			iLicensorid = value;
			if (value != null) value.addContractsWhereIAmLicensorid( (nl.reinders.bm.Contract)this );
			firePropertyChange(LICENSORID_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="licensorid") 
	private nl.reinders.bm.Relation iLicensorid;
	final static public String LICENSORID_PROPERTY_ID = "licensorid";
	final static public Class LICENSORID_PROPERTY_CLASS = nl.reinders.bm.Relation.class;
	final static public String LICENSORID_NAME = "Licensorid"; // with this ID you can access the internationalization
	// to make IN queryies possible
	@Column(name="licensorid", insertable=false, updatable=false)
	private java.math.BigDecimal iLicensoridnr = null;

	/** Licenseeid */
	public nl.reinders.bm.Relation getLicenseeid() { return iLicenseeid; }
	public void setLicenseeid(nl.reinders.bm.Relation value)
	{
		if (value == iLicenseeid) return; // optimalisation and prevent looping
		try
		{
			nl.reinders.bm.Relation lValue = iLicenseeid;
			fireVetoableChange(LICENSEEID_PROPERTY_ID, lValue, value);
			if (lValue != null) lValue.removeContractsWhereIAmLicenseeid( (nl.reinders.bm.Contract)this );
			iLicenseeid = value;
			if (value != null) value.addContractsWhereIAmLicenseeid( (nl.reinders.bm.Contract)this );
			firePropertyChange(LICENSEEID_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="licenseeid") 
	private nl.reinders.bm.Relation iLicenseeid;
	final static public String LICENSEEID_PROPERTY_ID = "licenseeid";
	final static public Class LICENSEEID_PROPERTY_CLASS = nl.reinders.bm.Relation.class;
	final static public String LICENSEEID_NAME = "Licenseeid"; // with this ID you can access the internationalization
	// to make IN queryies possible
	@Column(name="licenseeid", insertable=false, updatable=false)
	private java.math.BigDecimal iLicenseeidnr = null;



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

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

	/** Description */
	public String getDescription() { return iDescription; }
	public void setDescription(String value)
	{
		try
		{
			String lValue = iDescription;
			if (log4j.isDebugEnabled()) log4j.debug("setDescription: " + lValue + " -> " + value);
			fireVetoableChange(DESCRIPTION_PROPERTY_ID, lValue, value);
			iDescription = value;
			firePropertyChange(DESCRIPTION_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="description")
	private String iDescription = null;
	final static public String DESCRIPTION_PROPERTY_ID = "description";
	final static public Class DESCRIPTION_PROPERTY_CLASS = String.class;
	final static public String DESCRIPTION_NAME = "Description"; // with this ID you can access the internationalization

	/** Start */
	public java.util.Calendar getStart() { return iStart; }
	public void setStart(java.util.Calendar value)
	{
		try
		{
			java.util.Calendar lValue = iStart;
			if (log4j.isDebugEnabled()) log4j.debug("setStart: " + lValue + " -> " + value);
			fireVetoableChange(START_PROPERTY_ID, lValue, value);
			iStart = value;
			firePropertyChange(START_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Temporal(TemporalType.TIMESTAMP) @Column(name="start")
	private java.util.Calendar iStart = null;
	final static public String START_PROPERTY_ID = "start";
	final static public Class START_PROPERTY_CLASS = java.util.Calendar.class;
	final static public String START_NAME = "Start"; // with this ID you can access the internationalization

	/** End */
	public java.util.Calendar getEnd() { return iEnd; }
	public void setEnd(java.util.Calendar value)
	{
		try
		{
			java.util.Calendar lValue = iEnd;
			if (log4j.isDebugEnabled()) log4j.debug("setEnd: " + lValue + " -> " + value);
			fireVetoableChange(END_PROPERTY_ID, lValue, value);
			iEnd = value;
			firePropertyChange(END_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Temporal(TemporalType.TIMESTAMP) @Column(name="end")
	private java.util.Calendar iEnd = null;
	final static public String END_PROPERTY_ID = "end";
	final static public Class END_PROPERTY_CLASS = java.util.Calendar.class;
	final static public String END_NAME = "End"; // with this ID you can access the internationalization

	/** Territory */
	public String getTerritory() { return iTerritory; }
	public void setTerritory(String value)
	{
		try
		{
			String lValue = iTerritory;
			if (log4j.isDebugEnabled()) log4j.debug("setTerritory: " + lValue + " -> " + value);
			fireVetoableChange(TERRITORY_PROPERTY_ID, lValue, value);
			iTerritory = value;
			firePropertyChange(TERRITORY_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="territory")
	private String iTerritory = null;
	final static public String TERRITORY_PROPERTY_ID = "territory";
	final static public Class TERRITORY_PROPERTY_CLASS = String.class;
	final static public String TERRITORY_NAME = "Territory"; // with this ID you can access the internationalization

	/** Wholesaleroyaltyrate */
	public java.math.BigDecimal getWholesaleroyaltyrate() { return iWholesaleroyaltyrate; }
	public void setWholesaleroyaltyrate(java.math.BigDecimal value)
	{
		try
		{
			java.math.BigDecimal lValue = iWholesaleroyaltyrate;
			if (log4j.isDebugEnabled()) log4j.debug("setWholesaleroyaltyrate: " + lValue + " -> " + value);
			fireVetoableChange(WHOLESALEROYALTYRATE_PROPERTY_ID, lValue, value);
			iWholesaleroyaltyrate = value;
			firePropertyChange(WHOLESALEROYALTYRATE_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="wholesaleroyaltyrate")
	private java.math.BigDecimal iWholesaleroyaltyrate = null;
	final static public String WHOLESALEROYALTYRATE_PROPERTY_ID = "wholesaleroyaltyrate";
	final static public Class WHOLESALEROYALTYRATE_PROPERTY_CLASS = java.math.BigDecimal.class;
	final static public String WHOLESALEROYALTYRATE_NAME = "Wholesaleroyaltyrate"; // with this ID you can access the internationalization

	/** Retailroyaltyrate */
	public java.math.BigDecimal getRetailroyaltyrate() { return iRetailroyaltyrate; }
	public void setRetailroyaltyrate(java.math.BigDecimal value)
	{
		try
		{
			java.math.BigDecimal lValue = iRetailroyaltyrate;
			if (log4j.isDebugEnabled()) log4j.debug("setRetailroyaltyrate: " + lValue + " -> " + value);
			fireVetoableChange(RETAILROYALTYRATE_PROPERTY_ID, lValue, value);
			iRetailroyaltyrate = value;
			firePropertyChange(RETAILROYALTYRATE_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="retailroyaltyrate")
	private java.math.BigDecimal iRetailroyaltyrate = null;
	final static public String RETAILROYALTYRATE_PROPERTY_ID = "retailroyaltyrate";
	final static public Class RETAILROYALTYRATE_PROPERTY_CLASS = java.math.BigDecimal.class;
	final static public String RETAILROYALTYRATE_NAME = "Retailroyaltyrate"; // with this ID you can access the internationalization

	/** Advance */
	public Integer getAdvance() { return iAdvance; }
	public void setAdvance(Integer value)
	{
		try
		{
			Integer lValue = iAdvance;
			if (log4j.isDebugEnabled()) log4j.debug("setAdvance: " + lValue + " -> " + value);
			fireVetoableChange(ADVANCE_PROPERTY_ID, lValue, value);
			iAdvance = value;
			firePropertyChange(ADVANCE_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="advance")
	private Integer iAdvance = null;
	final static public String ADVANCE_PROPERTY_ID = "advance";
	final static public Class ADVANCE_PROPERTY_CLASS = Integer.class;
	final static public String ADVANCE_NAME = "Advance"; // with this ID you can access the internationalization

	/** Guarantee */
	public Integer getGuarantee() { return iGuarantee; }
	public void setGuarantee(Integer value)
	{
		try
		{
			Integer lValue = iGuarantee;
			if (log4j.isDebugEnabled()) log4j.debug("setGuarantee: " + lValue + " -> " + value);
			fireVetoableChange(GUARANTEE_PROPERTY_ID, lValue, value);
			iGuarantee = value;
			firePropertyChange(GUARANTEE_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="guarantee")
	private Integer iGuarantee = null;
	final static public String GUARANTEE_PROPERTY_ID = "guarantee";
	final static public Class GUARANTEE_PROPERTY_CLASS = Integer.class;
	final static public String GUARANTEE_NAME = "Guarantee"; // with this ID you can access the internationalization

	/** Selloff */
	public String getSelloff() { return iSelloff; }
	public void setSelloff(String value)
	{
		try
		{
			String lValue = iSelloff;
			if (log4j.isDebugEnabled()) log4j.debug("setSelloff: " + lValue + " -> " + value);
			fireVetoableChange(SELLOFF_PROPERTY_ID, lValue, value);
			iSelloff = value;
			firePropertyChange(SELLOFF_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="selloff")
	private String iSelloff = null;
	final static public String SELLOFF_PROPERTY_ID = "selloff";
	final static public Class SELLOFF_PROPERTY_CLASS = String.class;
	final static public String SELLOFF_NAME = "Selloff"; // with this ID you can access the internationalization

	/** Signdate */
	public java.util.Calendar getSigndate() { return iSigndate; }
	public void setSigndate(java.util.Calendar value)
	{
		try
		{
			java.util.Calendar lValue = iSigndate;
			if (log4j.isDebugEnabled()) log4j.debug("setSigndate: " + lValue + " -> " + value);
			fireVetoableChange(SIGNDATE_PROPERTY_ID, lValue, value);
			iSigndate = value;
			firePropertyChange(SIGNDATE_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Temporal(TemporalType.TIMESTAMP) @Column(name="signdate")
	private java.util.Calendar iSigndate = null;
	final static public String SIGNDATE_PROPERTY_ID = "signdate";
	final static public Class SIGNDATE_PROPERTY_CLASS = java.util.Calendar.class;
	final static public String SIGNDATE_NAME = "Signdate"; // with this ID you can access the internationalization

	/** Exemptiondocs */
	public String getExemptiondocs() { return iExemptiondocs; }
	public void setExemptiondocs(String value)
	{
		try
		{
			String lValue = iExemptiondocs;
			if (log4j.isDebugEnabled()) log4j.debug("setExemptiondocs: " + lValue + " -> " + value);
			fireVetoableChange(EXEMPTIONDOCS_PROPERTY_ID, lValue, value);
			iExemptiondocs = value;
			firePropertyChange(EXEMPTIONDOCS_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="exemptiondocs")
	private String iExemptiondocs = null;
	final static public String EXEMPTIONDOCS_PROPERTY_ID = "exemptiondocs";
	final static public Class EXEMPTIONDOCS_PROPERTY_CLASS = String.class;
	final static public String EXEMPTIONDOCS_NAME = "Exemptiondocs"; // with this ID you can access the internationalization

	/** Info */
	public String getInfo() { return iInfo; }
	public void setInfo(String value)
	{
		try
		{
			String lValue = iInfo;
			if (log4j.isDebugEnabled()) log4j.debug("setInfo: " + lValue + " -> " + value);
			fireVetoableChange(INFO_PROPERTY_ID, lValue, value);
			iInfo = value;
			firePropertyChange(INFO_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="info")
	private String iInfo = null;
	final static public String INFO_PROPERTY_ID = "info";
	final static public Class INFO_PROPERTY_CLASS = String.class;
	final static public String INFO_NAME = "Info"; // with this ID you can access the internationalization

	/** Currency */
	public String getCurrency() { return iCurrency; }
	public void setCurrency(String value)
	{
		try
		{
			String lValue = iCurrency;
			if (log4j.isDebugEnabled()) log4j.debug("setCurrency: " + lValue + " -> " + value);
			fireVetoableChange(CURRENCY_PROPERTY_ID, lValue, value);
			iCurrency = value;
			firePropertyChange(CURRENCY_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="currency")
	private String iCurrency = null;
	final static public String CURRENCY_PROPERTY_ID = "currency";
	final static public Class CURRENCY_PROPERTY_CLASS = String.class;
	final static public String CURRENCY_NAME = "Currency"; // with this ID you can access the internationalization

	/** Payment */
	public String getPayment() { return iPayment; }
	public void setPayment(String value)
	{
		try
		{
			String lValue = iPayment;
			if (log4j.isDebugEnabled()) log4j.debug("setPayment: " + lValue + " -> " + value);
			fireVetoableChange(PAYMENT_PROPERTY_ID, lValue, value);
			iPayment = value;
			firePropertyChange(PAYMENT_PROPERTY_ID, lValue, value);
		}
		catch (java.beans.PropertyVetoException e) { throw new java.lang.IllegalArgumentException("Value vetoed: " + e.getMessage()); }
	}
	@Column(name="payment")
	private String iPayment = null;
	final static public String PAYMENT_PROPERTY_ID = "payment";
	final static public Class PAYMENT_PROPERTY_CLASS = String.class;
	final static public String PAYMENT_NAME = "Payment"; // 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

	/** 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


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

	/** clone */
	public Object clone()
	{ 
		nl.reinders.bm.Contract lNew = new nl.reinders.bm.Contract();
		lNew.setLicensorid( getLicensorid() ); 
		lNew.setLicenseeid( getLicenseeid() ); 
		lNew.setDescription( getDescription() ); 
		lNew.setStart( getStart() ); 
		lNew.setEnd( getEnd() ); 
		lNew.setTerritory( getTerritory() ); 
		lNew.setWholesaleroyaltyrate( getWholesaleroyaltyrate() ); 
		lNew.setRetailroyaltyrate( getRetailroyaltyrate() ); 
		lNew.setAdvance( getAdvance() ); 
		lNew.setGuarantee( getGuarantee() ); 
		lNew.setSelloff( getSelloff() ); 
		lNew.setSigndate( getSigndate() ); 
		lNew.setExemptiondocs( getExemptiondocs() ); 
		lNew.setInfo( getInfo() ); 
		lNew.setCurrency( getCurrency() ); 
		lNew.setPayment( getPayment() ); 
		// not cloning this column: lNew.setDwhmodified( getDwhmodified() ); 
		// not cloning this column: lNew.setDwhby( getDwhby() ); 
		return lNew;
	}
	public nl.reinders.bm.Contract cloneShallow() { return (nl.reinders.bm.Contract)clone();}


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

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


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

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

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

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


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

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



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

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


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