/*
 * This class is autogenerated if it does not exists. It may be modified.
 * Copyright: (c) Reinders Posters
 * Modified:  $Date: 2007/05/16 12:11:59 $
 */

package nl.reinders.bm;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.EntityManager;
import javax.persistence.Query;

/**
 * A JPA entity class for batchtype.
 * @version    $Revision: 1.5 $
 * @author     $Author: toeukpap $
 */
@Entity
@Table(name="batchtype")
public class Batchtype extends nl.reinders.bm.generated.Batchtype
implements java.io.Serializable
{
	static final long serialVersionUID = 0;
	static final String SOURCECODE_VERSION = "$Revision: 1.5 $";
	static org.apache.log4j.Logger log4j = org.apache.log4j.Logger.getLogger(Batchtype.class.getName());

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

	/**
	 * @param value
	 */
	static public nl.reinders.bm.Batchtype findByDescription(String value)
	{
		EntityManager lEntityManager = org.tbee.util.jpa.EntityManagerFinder.findEntityManager();
		Query lQuery = lEntityManager.createQuery("select t from Batchtype t where t.iDescription=:description");
		lQuery.setParameter("description", value);
		java.util.List<nl.reinders.bm.Batchtype> lList = lQuery.getResultList();
	    if (lList.size() == 0) return null;
	    return lList.get(0);
	}

	/**
	 * @param value
	 */
	static public nl.reinders.bm.Batchtype findByDescriptionIgnoreCase(String value)
	{
		EntityManager lEntityManager = org.tbee.util.jpa.EntityManagerFinder.findEntityManager();
		Query lQuery = lEntityManager.createQuery("select t from Batchtype t where lower(t.iDescription)=:description");
		lQuery.setParameter("description", value.toLowerCase());
		java.util.List<nl.reinders.bm.Batchtype> lList = lQuery.getResultList();
	    if (lList.size() == 0) return null;
	    return lList.get(0);
	}
}
