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

📄 hibernatepricingdao.java~5~

📁 EJB+Hibernate+Spring 电信计费系统
💻 JAVA~5~
字号:
package tarena.netctoss.dao;

import java.util.*;

import tarena.netctoss.exception.*;
import tarena.netctoss.model.*;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.hibernate.Session;
import java.sql.SQLException;
import org.hibernate.HibernateException;
import org.hibernate.Query;

public class HibernatePricingDAO extends HibernateDaoSupport implements PricingDAO {
    /**
     * deletePricing
     *
     * @param pricing Tpricing
     * @throws InfrastructureException
     * @todo Implement this tarena.netctoss.dao.PricingDAO method
     */
    public void deletePricing(Tpricing pricing) throws InfrastructureException {
        try{
            this.getHibernateTemplate().delete(pricing);
        }catch(Exception e){
            e.printStackTrace();
            throw new InfrastructureException(e.getMessage());
        }
    }

    /**
     * deletePricing
     *
     * @param pricingId Long
     * @throws InfrastructureException
     * @todo Implement this tarena.netctoss.dao.PricingDAO method
     */
    public void deletePricing(Long pricingId) throws InfrastructureException {
        Tpricing pricing = new Tpricing();
        pricing.setPricingId(pricingId);
        try{
            this.getHibernateTemplate().delete(pricing);
        }catch(Exception e){
            e.printStackTrace();
            throw new InfrastructureException(e.getMessage());
        }
    }

    /**
     * deletePricings
     *
     * @param pricingId Long[]
     * @throws InfrastructureException
     * @todo Implement this tarena.netctoss.dao.PricingDAO method
     */
    public void deletePricings(Long[] pricingId) throws InfrastructureException {
        final StringBuffer sql = new StringBuffer("delete from Tpricing pricing where pricing.pricingId in(");
        for(int i=0;i<pricingId.length;i++){
            if(i==0)
                sql.append(pricingId[i]);
            else
                sql.append(","+pricingId[i]);
        }
        sql.append(")");

        this.getHibernateTemplate().execute(new HibernateCallback(){
            public Object doInHibernate(Session session) throws SQLException,
                    HibernateException {
                Query query = session.createQuery(sql.toString());
                return null;
            }
        });
    }

    /**
     * insertPricing
     *
     * @param pricing Tpricing
     * @throws InfrastructureException
     * @todo Implement this tarena.netctoss.dao.PricingDAO method
     */
    public void insertPricing(Tpricing pricing) throws InfrastructureException {
    }

    /**
     * selectAllPricing
     *
     * @return Collection
     * @throws InfrastructureException
     * @todo Implement this tarena.netctoss.dao.PricingDAO method
     */
    public Collection selectAllPricing() throws InfrastructureException {
        return null;
    }

    /**
     * selectPricingByBaseFeeAndRateFee
     *
     * @param baseFee double
     * @param rateFee double
     * @return boolean
     * @throws InfrastructureException
     * @todo Implement this tarena.netctoss.dao.PricingDAO method
     */
    public boolean selectPricingByBaseFeeAndRateFee(double baseFee,
            double rateFee) throws InfrastructureException {
        return false;
    }

    /**
     * selectPricingById
     *
     * @param pricingId Long
     * @return Tpricing
     * @throws InfrastructureException
     * @todo Implement this tarena.netctoss.dao.PricingDAO method
     */
    public Tpricing selectPricingById(Long pricingId) throws
            InfrastructureException {
        return null;
    }

    /**
     * updatePricing
     *
     * @param pricing Tpricing
     * @throws InfrastructureException
     * @todo Implement this tarena.netctoss.dao.PricingDAO method
     */
    public void updatePricing(Tpricing pricing) throws InfrastructureException {
    }
}

⌨️ 快捷键说明

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