1 7 package org.jfox.petstore.bo; 8 9 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 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 } 33 catch (SQLException e) { 34 throw new EJBException (e); 35 } 36 } 37 38 public List <Order> getOrdersByUsername(String username) { 39 try { 40 return orderDAO.getOrdersByUsername(username); 41 } 42 catch (SQLException e) { 43 throw new EJBException (e); 44 } 45 } 46 47 public void insertOrder(Order order) { 48 try { 49 orderDAO.insertOrder(order); 50 } 51 catch (Exception e) { 52 throw new EJBException (e); 53 } 54 } 55 56 public static void main(String [] args) { 57 58 } 59 } 60 | Popular Tags |