FileDocCategorySizeDatePackage
SqlMapOrderDao.javaAPI DocExample1705Sat Dec 27 17:31:34 GMT 2003org.springframework.samples.jpetstore.dao.ibatis

SqlMapOrderDao

public class SqlMapOrderDao extends org.springframework.orm.ibatis.support.SqlMapDaoSupport implements org.springframework.samples.jpetstore.dao.OrderDao

Fields Summary
private SqlMapSequenceDao
sequenceDao
Constructors Summary
Methods Summary
public org.springframework.samples.jpetstore.domain.OrdergetOrder(int orderId)

    Object parameterObject = new Integer(orderId);
    Order order = (Order) getSqlMapTemplate().executeQueryForObject("getOrder", parameterObject);
		if (order != null) {
    	order.setLineItems(getSqlMapTemplate().executeQueryForList("getLineItemsByOrderId", new Integer(order.getOrderId())));
		}
    return order;
  
public java.util.ListgetOrdersByUsername(java.lang.String username)

    return getSqlMapTemplate().executeQueryForList("getOrdersByUsername", username);
  
public voidinsertOrder(org.springframework.samples.jpetstore.domain.Order order)

		order.setOrderId(this.sequenceDao.getNextId("ordernum"));
		getSqlMapTemplate().executeUpdate("insertOrder", order);
		getSqlMapTemplate().executeUpdate("insertOrderStatus", order);
    for (int i = 0; i < order.getLineItems().size(); i++) {
      LineItem lineItem = (LineItem) order.getLineItems().get(i);
      lineItem.setOrderId(order.getOrderId());
      getSqlMapTemplate().executeUpdate("insertLineItem", lineItem);
    }
  
public voidsetSequenceDao(SqlMapSequenceDao sequenceDao)

		this.sequenceDao = sequenceDao;