药品表dao.java

来自「医院信息系统(Hospital Information System」· Java 代码 · 共 176 行

JAVA
176
字号
package hospital.Model;

import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.criterion.Example;

/**
 * Data access object (DAO) for domain model class 药品表.
 * @see hospital.Model.药品表
 * @author MyEclipse - Hibernate Tools
 */
public class 药品表DAO extends BaseHibernateDAO {

    private static final Log log = LogFactory.getLog(药品表DAO.class);

	//property constants
	public static final String _药品编号 = "药品编号";
	public static final String _医用名称 = "医用名称";
	public static final String _商用名称 = "商用名称";
	public static final String _剂量类型 = "剂量类型";
	public static final String _拼音缩写 = "拼音缩写";
	public static final String _规格 = "规格";
	public static final String _删除标志 = "删除标志";
	public static final String _固定价格 = "固定价格";
	public static final String _浮动价格 = "浮动价格";
	public static final String _药品类型 = "药品类型";
	public static final String _库存数量 = "库存数量";

    
    public void save(药品表 transientInstance) {
        log.debug("saving 药品表 instance");
        try {
            getSession().save(transientInstance);
            log.debug("save successful");
        } catch (RuntimeException re) {
            log.error("save failed", re);
            throw re;
        }
    }
    
	public void delete(药品表 persistentInstance) {
        log.debug("deleting 药品表 instance");
        try {
            getSession().delete(persistentInstance);
            log.debug("delete successful");
        } catch (RuntimeException re) {
            log.error("delete failed", re);
            throw re;
        }
    }
    
    public 药品表 findById( java.lang.Integer id) {
        log.debug("getting 药品表 instance with id: " + id);
        try {
            药品表 instance = (药品表) getSession()
                    .get("hospital.Model.药品表", id);
            return instance;
        } catch (RuntimeException re) {
            log.error("get failed", re);
            throw re;
        }
    }
    
    
    public List findByExample(药品表 instance) {
        log.debug("finding 药品表 instance by example");
        try {
            List results = getSession()
                    .createCriteria("hospital.Model.药品表")
                    .add(Example.create(instance))
            .list();
            log.debug("find by example successful, result size: " + results.size());
            return results;
        } catch (RuntimeException re) {
            log.error("find by example failed", re);
            throw re;
        }
    }    
    
    public List findByProperty(String propertyName, Object value) {
      log.debug("finding 药品表 instance with property: " + propertyName
            + ", value: " + value);
      try {
         String queryString = "from 药品表 as model where model." 
         						+ propertyName + "= ?";
         Query queryObject = getSession().createQuery(queryString);
		 queryObject.setParameter(0, value);
		 return queryObject.list();
      } catch (RuntimeException re) {
         log.error("find by property name failed", re);
         throw re;
      }
	}

	public List findBy药品编号(Object 药品编号) {
		return findByProperty(_药品编号, 药品编号);
	}
	
	public List findBy医用名称(Object 医用名称) {
		return findByProperty(_医用名称, 医用名称);
	}
	
	public List findBy商用名称(Object 商用名称) {
		return findByProperty(_商用名称, 商用名称);
	}
	
	public List findBy剂量类型(Object 剂量类型) {
		return findByProperty(_剂量类型, 剂量类型);
	}
	
	public List findBy拼音缩写(Object 拼音缩写) {
		return findByProperty(_拼音缩写, 拼音缩写);
	}
	
	public List findBy规格(Object 规格) {
		return findByProperty(_规格, 规格);
	}
	
	public List findBy删除标志(Object 删除标志) {
		return findByProperty(_删除标志, 删除标志);
	}
	
	public List findBy固定价格(Object 固定价格) {
		return findByProperty(_固定价格, 固定价格);
	}
	
	public List findBy浮动价格(Object 浮动价格) {
		return findByProperty(_浮动价格, 浮动价格);
	}
	
	public List findBy药品类型(Object 药品类型) {
		return findByProperty(_药品类型, 药品类型);
	}
	
	public List findBy库存数量(Object 库存数量) {
		return findByProperty(_库存数量, 库存数量);
	}
	
    public 药品表 merge(药品表 detachedInstance) {
        log.debug("merging 药品表 instance");
        try {
            药品表 result = (药品表) getSession()
                    .merge(detachedInstance);
            log.debug("merge successful");
            return result;
        } catch (RuntimeException re) {
            log.error("merge failed", re);
            throw re;
        }
    }

    public void attachDirty(药品表 instance) {
        log.debug("attaching dirty 药品表 instance");
        try {
            getSession().saveOrUpdate(instance);
            log.debug("attach successful");
        } catch (RuntimeException re) {
            log.error("attach failed", re);
            throw re;
        }
    }
    
    public void attachClean(药品表 instance) {
        log.debug("attaching clean 药品表 instance");
        try {
            getSession().lock(instance, LockMode.NONE);
            log.debug("attach successful");
        } catch (RuntimeException re) {
            log.error("attach failed", re);
            throw re;
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?