fieldlistdaoimpl.java

来自「基于Sturts+Spring+Hibernate的一个高级销售管理系统。内容丰」· Java 代码 · 共 244 行

JAVA
244
字号
package com.yuanchung.sales.dao.config;

import java.util.List;

import org.apache.log4j.Logger;
import org.hibernate.Query;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.yuanchung.sales.model.config.ConfigTree;
import com.yuanchung.sales.model.config.FieldList;

public class FieldListDAOImpl extends HibernateDaoSupport implements FieldListDAO {

	private static Logger logger = Logger.getLogger(FieldListDAOImpl.class);
	
	
	public void save(FieldList fieldList){
		try{
			getHibernateTemplate().save(fieldList);
		}catch(RuntimeException re){
			logger.error("save Object fieldList failed");
			throw re;
		}
	}

	public void delete(FieldList fieldList){
		try{
			getHibernateTemplate().delete(fieldList);
		}catch(RuntimeException re){
			logger.error("delete Object fieldList failed");
			throw re;
		}
	}

	public void update(FieldList fieldList){
		try{
			getHibernateTemplate().update(fieldList);
		}catch(RuntimeException re){
			
		}
	}
	
	public FieldList findById(java.lang.Integer id){
		try{
			return (FieldList)getHibernateTemplate().get("com.yuanchung.sales.model.config.FieldList", id);
		}catch(RuntimeException re){
			logger.error("save Object fieldList failed");
			throw re;
		}
	}

	public List findByExample(FieldList fieldList){
		try{
			return getHibernateTemplate().findByExample(fieldList);
		}catch(RuntimeException re){
			logger.error("find by example failed",re);
			throw re;
		}
	}

	public List findByProperty(String propertyName, Object value){
		logger.debug("from FieldList as model where model."+propertyName+"="+value);
		try {
			String queryString = "from FieldList as model where model."
					+ propertyName + "= ?";
			return getHibernateTemplate().find(queryString, value);
		} catch (RuntimeException re) {
			logger.error("find by property name failed", re);
			throw re;
		}
	}
	
	public List getByConfigTree(Object configTree){
		logger.debug("from FieldList get By configTree");
		try{
			return findByProperty("configTree",configTree);
		}catch(RuntimeException re){
			logger.error("getByconfigTree failed");
			throw re;
		}
	}
	
	public List findBydateTypeIsSelect(){
		logger.debug("from FieldList find By dataType is select");
		try{
			String sql = "from fieldList as model where model.dataType = 1";
			return getHibernateTemplate().find(sql);
		}catch(RuntimeException re){
			throw re;
		}
	}
	
	//接口
	public FieldList findBizType(){
		logger.debug("from FieldList find By fieldName is bizType");
		try{
			String sql = "from FieldList as model where model.fieldName = 'bizType'";
			return (FieldList)getHibernateTemplate().find(sql).get(0);
		}catch(RuntimeException re){
			throw re;
		}
	}

	public FieldList findCity() {
		logger.debug("from FieldList find By fieldName is city");
		try{
			String sql = "from FieldList as model where model.fieldName = 'city'";
			return (FieldList)getHibernateTemplate().find(sql).get(0);
		}catch(RuntimeException re){
			throw re;
		}
	}

	public FieldList findCounty() {
		logger.debug("from FieldList find By fieldName is county");
		try{
			String sql = "from FieldList as model where model.fieldName = 'county'";
			return (FieldList)getHibernateTemplate().find(sql).get(0);
		}catch(RuntimeException re){
			throw re;
		}
	}

	public FieldList findCustomerSource() {
		logger.debug("from FieldList find By fieldName is customerSource");
		try{
			String sql = "from FieldList as model where model.fieldName = 'customerSource'";
			return (FieldList)getHibernateTemplate().find(sql).get(0);
		}catch(RuntimeException re){
			throw re;
		}
	}

	public FieldList findCustomerState() {
		logger.debug("from FieldList find By fieldName is customerState");
		try{
			String sql = "from FieldList as model where model.fieldName = 'customerState'";
			return (FieldList)getHibernateTemplate().find(sql).get(0);
		}catch(RuntimeException re){
			throw re;
		}
	}

	public FieldList findEducation() {
		logger.debug("from FieldList find By fieldName is education");
		try{
			String sql = "from FieldList as model where model.fieldName = 'education'";
			return (FieldList)getHibernateTemplate().find(sql).get(0);
		}catch(RuntimeException re){
			throw re;
		}
	}

	public FieldList findEmployee_Num() {
		logger.debug("from FieldList find By fieldName is employee_Num");
		try{
			String sql = "from FieldList as model where model.fieldName = 'employee_Num'";
			return (FieldList)getHibernateTemplate().find(sql).get(0);
		}catch(RuntimeException re){
			throw re;
		}
	}

	public FieldList findHonestGrade() {
		logger.debug("from FieldList find By fieldName is honestGrade");
		try{
			String sql = "from FieldList as model where model.fieldName = 'honestGrade'";
			return (FieldList)getHibernateTemplate().find(sql).get(0);
		}catch(RuntimeException re){
			throw re;
		}
	}

	public FieldList findIndustryOf() {
		logger.debug("from FieldList find By fieldName is industryOf");
		try{
			String sql = "from FieldList as model where model.fieldName = 'industryOf'";
			return (FieldList)getHibernateTemplate().find(sql).get(0);
		}catch(RuntimeException re){
			throw re;
		}
	}

	public FieldList findIndustryType() {
		logger.debug("from FieldList find By fieldName is industryType");
		try{
			String sql = "from FieldList as model where model.fieldName = 'industryType'";
			return (FieldList)getHibernateTemplate().find(sql).get(0);
		}catch(RuntimeException re){
			throw re;
		}
	}

	public FieldList findProvince() {
		logger.debug("from FieldList find By fieldName is province");
		try{
			String sql = "from FieldList as model where model.fieldName = 'province'";
			return (FieldList)getHibernateTemplate().find(sql).get(0);
		}catch(RuntimeException re){
			throw re;
		}
	}

	public FieldList findRegionOf() {
		logger.debug("from FieldList find By fieldName is regionOf");
		try{
			String sql = "from FieldList as model where model.fieldName = 'regionOf'";
			return (FieldList)getHibernateTemplate().find(sql).get(0);
		}catch(RuntimeException re){
			throw re;
		}
	}

	public FieldList findSatulation() {
		logger.debug("from FieldList find By fieldName is satulation");
		try{
			String sql = "from FieldList as model where model.fieldName = 'satulation'";
			return (FieldList)getHibernateTemplate().find(sql).get(0);
		}catch(RuntimeException re){
			throw re;
		}
	}

	public FieldList findStageOf() {
		logger.debug("from FieldList find By fieldName is stageOf");
		try{
			String sql = "from FieldList as model where model.fieldName = 'stageOf'";
			return (FieldList)getHibernateTemplate().find(sql).get(0);
		}catch(RuntimeException re){
			throw re;
		}
	}

	public FieldList findManager_Level() {
		logger.debug("from FieldList find By fieldName is manager_Level");
		try{
			String sql = "from FieldList as model where model.fieldName = 'manager_Level'";
			return (FieldList)getHibernateTemplate().find(sql).get(0);
		}catch(RuntimeException re){
			throw re;
		}
	}
}

⌨️ 快捷键说明

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