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

📄 orderbusinessimpl.java

📁 企业内部培训系统
💻 JAVA
字号:
package cn.com.tarena.ecport.biz.impl;import java.util.List;import org.hibernate.HibernateException;import org.hibernate.Session;import business.impl.test.HibernateUtil;import cn.com.tarena.ecport.biz.IOrderBusiness;import cn.com.tarena.ecport.dao.IOrdersDAO;import cn.com.tarena.ecport.dao.IProductDAO;import cn.com.tarena.ecport.dao.factory.DAOFactory;import cn.com.tarena.ecport.exception.ECPortException;import cn.com.tarena.ecport.pojo.Orders;public class OrderBusinessImpl implements IOrderBusiness {	public void checkOut(Orders order) throws ECPortException {		IOrdersDAO ob = (IOrdersDAO) DAOFactory.getDAO(IOrdersDAO.class				.getName());		try {			HibernateUtil.getSessionFactory().getCurrentSession()					.beginTransaction();			ob.saveOrUpdate(order);			HibernateUtil.getSessionFactory().getCurrentSession()					.getTransaction().commit();		} catch (HibernateException e) {			HibernateUtil.getSessionFactory().getCurrentSession()					.getTransaction().rollback();			e.printStackTrace();		}	}	public void deleteOrder(Orders order) throws ECPortException {		// TODO Auto-generated method stub	}	public void deleteOrderById(Long orderid) throws ECPortException {		IOrdersDAO od = (IOrdersDAO) DAOFactory.getDAO(IOrdersDAO.class				.getName());		try {			HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction();			od.delete(od.findById(orderid));			HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().commit();		} catch (HibernateException e) {			HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().rollback();			e.printStackTrace();		} finally {			HibernateUtil.getSessionFactory().getCurrentSession().close();		}	}	public List<Orders> findAllOrders() throws ECPortException {		IOrdersDAO od = (IOrdersDAO) DAOFactory.getDAO(IOrdersDAO.class				.getName());		List<Orders> list=null;		try {			HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction();			list = od.findAllOrders();			HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().commit();		} catch (HibernateException e) {			HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().rollback();			e.printStackTrace();		} finally {			HibernateUtil.getSessionFactory().getCurrentSession().close();		}		return list;	}	public Orders getOrderById(Long orderid) throws ECPortException {		IOrdersDAO od = (IOrdersDAO) DAOFactory.getDAO(IOrdersDAO.class				.getName());					HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction();			Orders order = od.findById(orderid);			HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().commit();			return order;					}	public List<Orders> getOrderListByUserId(String userid)			throws ECPortException {		return null;	}}

⌨️ 快捷键说明

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