⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gycustomerdao.java

📁 关于网上汽车销售系统的详细编程项目实战实例
💻 JAVA
字号:
package com.company.hib.dao.impl;


import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.ActionForm;
import org.hibernate.LockMode;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.company.hib.dao.DAOAdapter;
import com.company.struts.form.GyCustomer;

/**
 * Data access object (DAO) for domain model class GyCustomer.
 * 
 * @see com.company.struts.form.GyCustomer
 * @author MyEclipse Persistence Tools
 */

public class GyCustomerDAO extends DAOAdapter {
	private static final Log log = LogFactory.getLog(GyCustomerDAO.class);

	// property constants
	public static final String CUS_NAME = "cusName";

	public static final String STOP_FLAG = "stopFlag";

	public static final String AREA_CODE = "areaCode";

	public static final String TRADE_CODE = "tradeCode";

	public static final String ADDRESS = "address";

	public static final String POST_CODE = "postCode";

	public static final String BANK = "bank";

	public static final String TAX_CODE = "taxCode";

	public static final String BANK_ACCOUNT = "bankAccount";

	public static final String FICT_PERSON = "fictPerson";

	public static final String EMAIL = "email";

	public static final String WORK_NET = "workNet";

	public static final String CONTACT_PERSON = "contactPerson";

	public static final String CONTACT_TYPE = "contactType";

	public static final String PERSON_CODE = "personCode";

	public static final String CREDIT_GRADE = "creditGrade";

	public static final String CREDIT_MONEY = "creditMoney";

	public static final String CREDITAGE_MONEY = "creditageMoney";

	public static final String CREDIT_DATE = "creditDate";

	public static final String DES_ADDRESS = "desAddress";

	public static final String CUS_SUPER = "cusSuper";

	public static final String DEPT_CODE = "deptCode";

	public static final String RR_ACC_CODE = "rrAccCode";

	public static final String AR_ACC_CODE = "arAccCode";

	public static final String PR_ACC_CODE = "prAccCode";

	protected void initDao() {
		// do nothing
	}

	
	public ActionForm findById(java.lang.Integer id) {
		log.debug("getting GyCustomer instance with id: " + id);
		try {
			GyCustomer instance = (GyCustomer) getHibernateTemplate().get(
					"com.company.struts.form.GyCustomer", id);
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}

	public List findByExample(ActionForm instance) {
		log.debug("finding GyCustomer instance by example");
		try {
			List results = getHibernateTemplate().findByExample(instance);
			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 GyCustomer instance with property: " + propertyName
				+ ", value: " + value);
		try {
			String queryString = "from GyCustomer as model where model."
					+ propertyName + "= ?";
			return getHibernateTemplate().find(queryString, value);
		} catch (RuntimeException re) {
			log.error("find by property name failed", re);
			throw re;
		}
	}

	public List findByCusName(Object cusName) {
		return findByProperty(CUS_NAME, cusName);
	}

	public List findByStopFlag(Object stopFlag) {
		return findByProperty(STOP_FLAG, stopFlag);
	}

	public List findByAreaCode(Object areaCode) {
		return findByProperty(AREA_CODE, areaCode);
	}

	public List findByTradeCode(Object tradeCode) {
		return findByProperty(TRADE_CODE, tradeCode);
	}

	public List findByAddress(Object address) {
		return findByProperty(ADDRESS, address);
	}

	public List findByPostCode(Object postCode) {
		return findByProperty(POST_CODE, postCode);
	}

	public List findByBank(Object bank) {
		return findByProperty(BANK, bank);
	}

	public List findByTaxCode(Object taxCode) {
		return findByProperty(TAX_CODE, taxCode);
	}

	public List findByBankAccount(Object bankAccount) {
		return findByProperty(BANK_ACCOUNT, bankAccount);
	}

	public List findByFictPerson(Object fictPerson) {
		return findByProperty(FICT_PERSON, fictPerson);
	}

	public List findByEmail(Object email) {
		return findByProperty(EMAIL, email);
	}

	public List findByWorkNet(Object workNet) {
		return findByProperty(WORK_NET, workNet);
	}

	public List findByContactPerson(Object contactPerson) {
		return findByProperty(CONTACT_PERSON, contactPerson);
	}

	public List findByContactType(Object contactType) {
		return findByProperty(CONTACT_TYPE, contactType);
	}

	public List findByPersonCode(Object personCode) {
		return findByProperty(PERSON_CODE, personCode);
	}

	public List findByCreditGrade(Object creditGrade) {
		return findByProperty(CREDIT_GRADE, creditGrade);
	}

	public List findByCreditMoney(Object creditMoney) {
		return findByProperty(CREDIT_MONEY, creditMoney);
	}

	public List findByCreditageMoney(Object creditageMoney) {
		return findByProperty(CREDITAGE_MONEY, creditageMoney);
	}

	public List findByCreditDate(Object creditDate) {
		return findByProperty(CREDIT_DATE, creditDate);
	}

	public List findByDesAddress(Object desAddress) {
		return findByProperty(DES_ADDRESS, desAddress);
	}

	public List findByCusSuper(Object cusSuper) {
		return findByProperty(CUS_SUPER, cusSuper);
	}

	public List findByDeptCode(Object deptCode) {
		return findByProperty(DEPT_CODE, deptCode);
	}

	public List findByRrAccCode(Object rrAccCode) {
		return findByProperty(RR_ACC_CODE, rrAccCode);
	}

	public List findByArAccCode(Object arAccCode) {
		return findByProperty(AR_ACC_CODE, arAccCode);
	}

	public List findByPrAccCode(Object prAccCode) {
		return findByProperty(PR_ACC_CODE, prAccCode);
	}

	public List findAll() {
		log.debug("finding all GyCustomer instances");
		try {
			String queryString = "from GyCustomer";
			return getHibernateTemplate().find(queryString);
		} catch (RuntimeException re) {
			log.error("find all failed", re);
			throw re;
		}
	}

	public void attachDirty(GyCustomer instance) {
		log.debug("attaching dirty GyCustomer instance");
		try {
			getHibernateTemplate().saveOrUpdate(instance);
			log.debug("attach successful");
		} catch (RuntimeException re) {
			log.error("attach failed", re);
			throw re;
		}
	}

	public void attachClean(GyCustomer instance) {
		log.debug("attaching clean GyCustomer instance");
		try {
			getHibernateTemplate().lock(instance, LockMode.NONE);
			log.debug("attach successful");
		} catch (RuntimeException re) {
			log.error("attach failed", re);
			throw re;
		}
	}

	public static GyCustomerDAO getFromApplicationContext(ApplicationContext ctx) {
		return (GyCustomerDAO) ctx.getBean("GyCustomerDAO");
	}
}

⌨️ 快捷键说明

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