01: /*
02: * JFox - The most lightweight Java EE Application Server!
03: * more details please visit http://www.huihoo.org/jfox or http://www.jfox.org.cn.
04: *
05: * JFox is licenced and re-distributable under GNU LGPL.
06: */
07: package org.jfox.petstore.bo;
08:
09: import java.util.List;
10: import java.sql.SQLException;
11: import javax.ejb.Local;
12: import javax.ejb.Stateless;
13: import javax.ejb.EJB;
14: import javax.ejb.EJBException;
15:
16: import org.jfox.petstore.entity.Order;
17: import org.jfox.petstore.dao.OrderDAO;
18:
19: /**
20: * @author <a href="mailto:jfox.young@gmail.com">Young Yang</a>
21: */
22: @Stateless
23: @Local
24: public class OrderBOImpl implements OrderBO {
25:
26: @EJB
27: OrderDAO orderDAO;
28:
29: public Order getOrder(long orderId) {
30: try {
31: return orderDAO.getOrder(orderId);
32: } catch (SQLException e) {
33: throw new EJBException(e);
34: }
35: }
36:
37: public List<Order> getOrdersByUsername(String username) {
38: try {
39: return orderDAO.getOrdersByUsername(username);
40: } catch (SQLException e) {
41: throw new EJBException(e);
42: }
43: }
44:
45: public void insertOrder(Order order) {
46: try {
47: orderDAO.insertOrder(order);
48: } catch (Exception e) {
49: throw new EJBException(e);
50: }
51: }
52:
53: public static void main(String[] args) {
54:
55: }
56: }
|