Dao.CompanyinfoDAO.java Source code

Java tutorial

Introduction

Here is the source code for Dao.CompanyinfoDAO.java

Source

package Dao;

import java.util.List;
import java.util.Set;
import org.hibernate.LockOptions;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Example;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.transaction.annotation.Transactional;

/**
 * A data access object (DAO) providing persistence and search support for
 * Companyinfo entities. Transaction control of the save(), update() and
 * delete() operations can directly support Spring container-managed
 * transactions or they can be augmented to handle user-managed Spring
 * transactions. Each of these methods provides additional information for how
 * to configure it for the desired type of transaction control.
 * 
 * @see Dao.Companyinfo
 * @author MyEclipse Persistence Tools
 */
@Transactional
public class CompanyinfoDAO {
    private static final Logger log = LoggerFactory.getLogger(CompanyinfoDAO.class);
    // property constants
    public static final String COMPANY_PICTURE = "companyPicture";
    public static final String COMPANY_NAME = "companyName";
    public static final String HOST_NAME = "hostName";
    public static final String COMPANY_ADDRESS = "companyAddress";
    public static final String HOST_IDENTIFY = "hostIdentify";
    public static final String HOST_TELE_NO = "hostTeleNo";
    public static final String COMPANY_LICENSE = "companyLicense";
    public static final String XIAOGUIMO = "xiaoguimo";
    public static final String XIAOGUIMO_GOOD = "xiaoguimoGood";
    public static final String XIAOGUIMO_MIDDLE = "xiaoguimoMiddle";
    public static final String XIAOGUIMO_BAD = "xiaoguimoBad";
    public static final String XIAO_WHOLE_PRICE = "xiaoWholePrice";
    public static final String XIAO_HALF_PRICE = "xiaoHalfPrice";
    public static final String XIAO_QUARTER_PRICE = "xiaoQuarterPrice";
    public static final String YIBANREN = "yibanren";
    public static final String YIBANREN_GOOD = "yibanrenGood";
    public static final String YIBANREN_MIDDLE = "yibanrenMiddle";
    public static final String YIBANREN_BAD = "yibanrenBad";
    public static final String YI_WHOLE_PRICE = "yiWholePrice";
    public static final String YI_HALF_PRICE = "yiHalfPrice";
    public static final String YI_QUARTER_PRICE = "yiQuarterPrice";
    public static final String GAOXINJISHU = "gaoxinjishu";
    public static final String GAOXINJISHU_GOOD = "gaoxinjishuGood";
    public static final String GAOXINJISHU_MIDDLE = "gaoxinjishuMiddle";
    public static final String GAOXINJISHU_BAD = "gaoxinjishuBad";
    public static final String GAO_WHOLE_PRICE = "gaoWholePrice";
    public static final String GAO_HALF_PRICE = "gaoHalfPrice";
    public static final String GAO_QUARTER_PRICE = "gaoQuarterPrice";
    public static final String JINCHUKOU = "jinchukou";
    public static final String JINCHUKOU_GOOD = "jinchukouGood";
    public static final String JINCHUKOU_MIDDLE = "jinchukouMiddle";
    public static final String JINCHUKOU_BAD = "jinchukouBad";
    public static final String JIN_WHOLE_PRICE = "jinWholePrice";
    public static final String JIN_HALF_PRICE = "jinHalfPrice";
    public static final String JIN_QUARTER_PRICE = "jinQuarterPrice";
    public static final String STOCK_COMPANY = "stockCompany";
    public static final String STOCK_COMPANY_GOOD = "stockCompanyGood";
    public static final String STOCK_COMPANY_MIDDLE = "stockCompanyMiddle";
    public static final String STOCK_COMPANY_BAD = "stockCompanyBad";
    public static final String STOCK_PRICE = "stockPrice";
    public static final String NORMAL_COMPANY = "normalCompany";
    public static final String NORMAL_COMPANY_GOOD = "normalCompanyGood";
    public static final String NORMAL_COMPANY_MIDDLE = "normalCompanyMiddle";
    public static final String NORMAL_COMPANY_BAD = "normalCompanyBad";
    public static final String NORMAL_PRICE = "normalPrice";
    public static final String ONE_PERSON_LIMITED_COMPANY = "onePersonLimitedCompany";
    public static final String ONE_PERSON_LIMITED_COMPANY_GOOD = "onePersonLimitedCompanyGood";
    public static final String ONE_PERSON_LIMITED_COMPANY_MIDDLE = "onePersonLimitedCompanyMiddle";
    public static final String ONE_PERSON_LIMITED_COMPANY_BAD = "onePersonLimitedCompanyBad";
    public static final String ONE_PERSON_PRICE = "onePersonPrice";
    public static final String INDIVIDUAL_REGISTER = "individualRegister";
    public static final String INDIVIDUAL_REGISTER_GOOD = "individualRegisterGood";
    public static final String INDIVIDUAL_REGISTER_MIDDLE = "individualRegisterMiddle";
    public static final String INDIVIDUAL_REGISTER_BAD = "individualRegisterBad";
    public static final String INDIVIDUAL_PRICE = "individualPrice";
    public static final String COMPANY_CONVERSION = "companyConversion";
    public static final String COMPANY_CONVERSION_GOOD = "companyConversionGood";
    public static final String COMPANY_CONVERSION_MIDDLE = "companyConversionMiddle";
    public static final String COMPANY_CONVERSION_BAD = "companyConversionBad";
    public static final String CONVERSION_PRICE = "conversionPrice";
    public static final String STOCK_CHANGE = "stockChange";
    public static final String STOCK_CHANGE_GOOD = "stockChangeGood";
    public static final String STOCK_CHANGE_MIDDLE = "stockChangeMiddle";
    public static final String STOCK_CHANGE_BAD = "stockChangeBad";
    public static final String STOCK_CHANGE_PRICE = "stockChangePrice";
    public static final String ADDRESS_CHANGE = "addressChange";
    public static final String ADDRESS_CHANGE_GOOD = "addressChangeGood";
    public static final String ADDRESS_CHANGE_MIDDLE = "addressChangeMiddle";
    public static final String ADDRESS_CHANGE_BAD = "addressChangeBad";
    public static final String ADDRESS_CHANGE_PRICE = "addressChangePrice";
    public static final String COMMERCIAL_CANCELLATION = "commercialCancellation";
    public static final String COMMERCIAL_CANCELLATION_GOOD = "commercialCancellationGood";
    public static final String COMMERCIAL_CANCELLATION_MIDDLE = "commercialCancellationMiddle";
    public static final String COMMERCIAL_CANCELLATION_BAD = "commercialCancellationBad";
    public static final String COMMERCIAL_CANCELLATION_PRICE = "commercialCancellationPrice";

    private SessionFactory sessionFactory;

    public void setSessionFactory(SessionFactory sessionFactory) {
        this.sessionFactory = sessionFactory;
    }

    private Session getCurrentSession() {
        return sessionFactory.getCurrentSession();
    }

    protected void initDao() {
        // do nothing
    }

    public void save(Companyinfo transientInstance) {
        log.debug("saving Companyinfo instance");
        try {
            getCurrentSession().save(transientInstance);
            log.debug("save successful");
        } catch (RuntimeException re) {
            log.error("save failed", re);
            throw re;
        }
    }

    public void delete(Companyinfo persistentInstance) {
        log.debug("deleting Companyinfo instance");
        try {
            getCurrentSession().delete(persistentInstance);
            log.debug("delete successful");
        } catch (RuntimeException re) {
            log.error("delete failed", re);
            throw re;
        }
    }

    public Companyinfo findById(java.lang.Integer id) {
        log.debug("getting Companyinfo instance with id: " + id);
        try {
            Companyinfo instance = (Companyinfo) getCurrentSession().get("Dao.Companyinfo", id);
            return instance;
        } catch (RuntimeException re) {
            log.error("get failed", re);
            throw re;
        }
    }

    public List findByExample(Companyinfo instance) {
        log.debug("finding Companyinfo instance by example");
        try {
            List results = getCurrentSession().createCriteria("Dao.Companyinfo").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 Companyinfo instance with property: " + propertyName + ", value: " + value);
        try {
            String queryString = "from Companyinfo as model where model." + propertyName + "= ?";
            Query queryObject = getCurrentSession().createQuery(queryString);
            queryObject.setParameter(0, value);
            return queryObject.list();
        } catch (RuntimeException re) {
            log.error("find by property name failed", re);
            throw re;
        }
    }

    public List findByService(String serviceName) {
        try {
            String queryString = "from Companyinfo  where " + serviceName + " = 1";
            Query queryObject = getCurrentSession().createQuery(queryString);
            return queryObject.list();
        } catch (RuntimeException re) {
            log.error("find by property name failed", re);
            throw re;
        }
    }

    public List findByCompanyPicture(Object companyPicture) {
        return findByProperty(COMPANY_PICTURE, companyPicture);
    }

    public List findByCompanyName(Object companyName) {
        return findByProperty(COMPANY_NAME, companyName);
    }

    public List findByHostName(Object hostName) {
        return findByProperty(HOST_NAME, hostName);
    }

    public List findByCompanyAddress(Object companyAddress) {
        return findByProperty(COMPANY_ADDRESS, companyAddress);
    }

    public List findByHostIdentify(Object hostIdentify) {
        return findByProperty(HOST_IDENTIFY, hostIdentify);
    }

    public List findByHostTeleNo(Object hostTeleNo) {
        return findByProperty(HOST_TELE_NO, hostTeleNo);
    }

    public List findByCompanyLicense(Object companyLicense) {
        return findByProperty(COMPANY_LICENSE, companyLicense);
    }

    public List findByXiaoguimo(Object xiaoguimo) {
        return findByProperty(XIAOGUIMO, xiaoguimo);
    }

    public List findByXiaoguimoGood(Object xiaoguimoGood) {
        return findByProperty(XIAOGUIMO_GOOD, xiaoguimoGood);
    }

    public List findByXiaoguimoMiddle(Object xiaoguimoMiddle) {
        return findByProperty(XIAOGUIMO_MIDDLE, xiaoguimoMiddle);
    }

    public List findByXiaoguimoBad(Object xiaoguimoBad) {
        return findByProperty(XIAOGUIMO_BAD, xiaoguimoBad);
    }

    public List findByXiaoWholePrice(Object xiaoWholePrice) {
        return findByProperty(XIAO_WHOLE_PRICE, xiaoWholePrice);
    }

    public List findByXiaoHalfPrice(Object xiaoHalfPrice) {
        return findByProperty(XIAO_HALF_PRICE, xiaoHalfPrice);
    }

    public List findByXiaoQuarterPrice(Object xiaoQuarterPrice) {
        return findByProperty(XIAO_QUARTER_PRICE, xiaoQuarterPrice);
    }

    public List findByYibanren(Object yibanren) {
        return findByProperty(YIBANREN, yibanren);
    }

    public List findByYibanrenGood(Object yibanrenGood) {
        return findByProperty(YIBANREN_GOOD, yibanrenGood);
    }

    public List findByYibanrenMiddle(Object yibanrenMiddle) {
        return findByProperty(YIBANREN_MIDDLE, yibanrenMiddle);
    }

    public List findByYibanrenBad(Object yibanrenBad) {
        return findByProperty(YIBANREN_BAD, yibanrenBad);
    }

    public List findByYiWholePrice(Object yiWholePrice) {
        return findByProperty(YI_WHOLE_PRICE, yiWholePrice);
    }

    public List findByYiHalfPrice(Object yiHalfPrice) {
        return findByProperty(YI_HALF_PRICE, yiHalfPrice);
    }

    public List findByYiQuarterPrice(Object yiQuarterPrice) {
        return findByProperty(YI_QUARTER_PRICE, yiQuarterPrice);
    }

    public List findByGaoxinjishu(Object gaoxinjishu) {
        return findByProperty(GAOXINJISHU, gaoxinjishu);
    }

    public List findByGaoxinjishuGood(Object gaoxinjishuGood) {
        return findByProperty(GAOXINJISHU_GOOD, gaoxinjishuGood);
    }

    public List findByGaoxinjishuMiddle(Object gaoxinjishuMiddle) {
        return findByProperty(GAOXINJISHU_MIDDLE, gaoxinjishuMiddle);
    }

    public List findByGaoxinjishuBad(Object gaoxinjishuBad) {
        return findByProperty(GAOXINJISHU_BAD, gaoxinjishuBad);
    }

    public List findByGaoWholePrice(Object gaoWholePrice) {
        return findByProperty(GAO_WHOLE_PRICE, gaoWholePrice);
    }

    public List findByGaoHalfPrice(Object gaoHalfPrice) {
        return findByProperty(GAO_HALF_PRICE, gaoHalfPrice);
    }

    public List findByGaoQuarterPrice(Object gaoQuarterPrice) {
        return findByProperty(GAO_QUARTER_PRICE, gaoQuarterPrice);
    }

    public List findByJinchukou(Object jinchukou) {
        return findByProperty(JINCHUKOU, jinchukou);
    }

    public List findByJinchukouGood(Object jinchukouGood) {
        return findByProperty(JINCHUKOU_GOOD, jinchukouGood);
    }

    public List findByJinchukouMiddle(Object jinchukouMiddle) {
        return findByProperty(JINCHUKOU_MIDDLE, jinchukouMiddle);
    }

    public List findByJinchukouBad(Object jinchukouBad) {
        return findByProperty(JINCHUKOU_BAD, jinchukouBad);
    }

    public List findByJinWholePrice(Object jinWholePrice) {
        return findByProperty(JIN_WHOLE_PRICE, jinWholePrice);
    }

    public List findByJinHalfPrice(Object jinHalfPrice) {
        return findByProperty(JIN_HALF_PRICE, jinHalfPrice);
    }

    public List findByJinQuarterPrice(Object jinQuarterPrice) {
        return findByProperty(JIN_QUARTER_PRICE, jinQuarterPrice);
    }

    public List findByStockCompany(Object stockCompany) {
        return findByProperty(STOCK_COMPANY, stockCompany);
    }

    public List findByStockCompanyGood(Object stockCompanyGood) {
        return findByProperty(STOCK_COMPANY_GOOD, stockCompanyGood);
    }

    public List findByStockCompanyMiddle(Object stockCompanyMiddle) {
        return findByProperty(STOCK_COMPANY_MIDDLE, stockCompanyMiddle);
    }

    public List findByStockCompanyBad(Object stockCompanyBad) {
        return findByProperty(STOCK_COMPANY_BAD, stockCompanyBad);
    }

    public List findByStockPrice(Object stockPrice) {
        return findByProperty(STOCK_PRICE, stockPrice);
    }

    public List findByNormalCompany(Object normalCompany) {
        return findByProperty(NORMAL_COMPANY, normalCompany);
    }

    public List findByNormalCompanyGood(Object normalCompanyGood) {
        return findByProperty(NORMAL_COMPANY_GOOD, normalCompanyGood);
    }

    public List findByNormalCompanyMiddle(Object normalCompanyMiddle) {
        return findByProperty(NORMAL_COMPANY_MIDDLE, normalCompanyMiddle);
    }

    public List findByNormalCompanyBad(Object normalCompanyBad) {
        return findByProperty(NORMAL_COMPANY_BAD, normalCompanyBad);
    }

    public List findByNormalPrice(Object normalPrice) {
        return findByProperty(NORMAL_PRICE, normalPrice);
    }

    public List findByOnePersonLimitedCompany(Object onePersonLimitedCompany) {
        return findByProperty(ONE_PERSON_LIMITED_COMPANY, onePersonLimitedCompany);
    }

    public List findByOnePersonLimitedCompanyGood(Object onePersonLimitedCompanyGood) {
        return findByProperty(ONE_PERSON_LIMITED_COMPANY_GOOD, onePersonLimitedCompanyGood);
    }

    public List findByOnePersonLimitedCompanyMiddle(Object onePersonLimitedCompanyMiddle) {
        return findByProperty(ONE_PERSON_LIMITED_COMPANY_MIDDLE, onePersonLimitedCompanyMiddle);
    }

    public List findByOnePersonLimitedCompanyBad(Object onePersonLimitedCompanyBad) {
        return findByProperty(ONE_PERSON_LIMITED_COMPANY_BAD, onePersonLimitedCompanyBad);
    }

    public List findByOnePersonPrice(Object onePersonPrice) {
        return findByProperty(ONE_PERSON_PRICE, onePersonPrice);
    }

    public List findByIndividualRegister(Object individualRegister) {
        return findByProperty(INDIVIDUAL_REGISTER, individualRegister);
    }

    public List findByIndividualRegisterGood(Object individualRegisterGood) {
        return findByProperty(INDIVIDUAL_REGISTER_GOOD, individualRegisterGood);
    }

    public List findByIndividualRegisterMiddle(Object individualRegisterMiddle) {
        return findByProperty(INDIVIDUAL_REGISTER_MIDDLE, individualRegisterMiddle);
    }

    public List findByIndividualRegisterBad(Object individualRegisterBad) {
        return findByProperty(INDIVIDUAL_REGISTER_BAD, individualRegisterBad);
    }

    public List findByIndividualPrice(Object individualPrice) {
        return findByProperty(INDIVIDUAL_PRICE, individualPrice);
    }

    public List findByCompanyConversion(Object companyConversion) {
        return findByProperty(COMPANY_CONVERSION, companyConversion);
    }

    public List findByCompanyConversionGood(Object companyConversionGood) {
        return findByProperty(COMPANY_CONVERSION_GOOD, companyConversionGood);
    }

    public List findByCompanyConversionMiddle(Object companyConversionMiddle) {
        return findByProperty(COMPANY_CONVERSION_MIDDLE, companyConversionMiddle);
    }

    public List findByCompanyConversionBad(Object companyConversionBad) {
        return findByProperty(COMPANY_CONVERSION_BAD, companyConversionBad);
    }

    public List findByConversionPrice(Object conversionPrice) {
        return findByProperty(CONVERSION_PRICE, conversionPrice);
    }

    public List findByStockChange(Object stockChange) {
        return findByProperty(STOCK_CHANGE, stockChange);
    }

    public List findByStockChangeGood(Object stockChangeGood) {
        return findByProperty(STOCK_CHANGE_GOOD, stockChangeGood);
    }

    public List findByStockChangeMiddle(Object stockChangeMiddle) {
        return findByProperty(STOCK_CHANGE_MIDDLE, stockChangeMiddle);
    }

    public List findByStockChangeBad(Object stockChangeBad) {
        return findByProperty(STOCK_CHANGE_BAD, stockChangeBad);
    }

    public List findByStockChangePrice(Object stockChangePrice) {
        return findByProperty(STOCK_CHANGE_PRICE, stockChangePrice);
    }

    public List findByAddressChange(Object addressChange) {
        return findByProperty(ADDRESS_CHANGE, addressChange);
    }

    public List findByAddressChangeGood(Object addressChangeGood) {
        return findByProperty(ADDRESS_CHANGE_GOOD, addressChangeGood);
    }

    public List findByAddressChangeMiddle(Object addressChangeMiddle) {
        return findByProperty(ADDRESS_CHANGE_MIDDLE, addressChangeMiddle);
    }

    public List findByAddressChangeBad(Object addressChangeBad) {
        return findByProperty(ADDRESS_CHANGE_BAD, addressChangeBad);
    }

    public List findByAddressChangePrice(Object addressChangePrice) {
        return findByProperty(ADDRESS_CHANGE_PRICE, addressChangePrice);
    }

    public List findByCommercialCancellation(Object commercialCancellation) {
        return findByProperty(COMMERCIAL_CANCELLATION, commercialCancellation);
    }

    public List findByCommercialCancellationGood(Object commercialCancellationGood) {
        return findByProperty(COMMERCIAL_CANCELLATION_GOOD, commercialCancellationGood);
    }

    public List findByCommercialCancellationMiddle(Object commercialCancellationMiddle) {
        return findByProperty(COMMERCIAL_CANCELLATION_MIDDLE, commercialCancellationMiddle);
    }

    public List findByCommercialCancellationBad(Object commercialCancellationBad) {
        return findByProperty(COMMERCIAL_CANCELLATION_BAD, commercialCancellationBad);
    }

    public List findByCommercialCancellationPrice(Object commercialCancellationPrice) {
        return findByProperty(COMMERCIAL_CANCELLATION_PRICE, commercialCancellationPrice);
    }

    public List findAll() {
        log.debug("finding all Companyinfo instances");
        try {
            String queryString = "from Companyinfo";
            Query queryObject = getCurrentSession().createQuery(queryString);
            return queryObject.list();
        } catch (RuntimeException re) {
            log.error("find all failed", re);
            throw re;
        }
    }

    public Companyinfo merge(Companyinfo detachedInstance) {
        log.debug("merging Companyinfo instance");
        try {
            Companyinfo result = (Companyinfo) getCurrentSession().merge(detachedInstance);
            log.debug("merge successful");
            return result;
        } catch (RuntimeException re) {
            log.error("merge failed", re);
            throw re;
        }
    }

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

    public void attachClean(Companyinfo instance) {
        log.debug("attaching clean Companyinfo instance");
        try {
            getCurrentSession().buildLockRequest(LockOptions.NONE).lock(instance);
            log.debug("attach successful");
        } catch (RuntimeException re) {
            log.error("attach failed", re);
            throw re;
        }
    }

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