FileDocCategorySizeDatePackage
MsSqlOrderDao.javaAPI DocExample1003Tue Dec 30 23:09:12 GMT 2003org.springframework.samples.jpetstore.dao.ibatis

MsSqlOrderDao

public class MsSqlOrderDao extends SqlMapOrderDao

Fields Summary
Constructors Summary
Methods Summary
public voidinsertOrder(org.springframework.samples.jpetstore.domain.Order order)
Whacked out MS SQL Server hack to allow Item ID to be retrieved so that we can use it to link the foreign key of the Line Items!

    Integer orderId = (Integer) getSqlMapTemplate().executeQueryForObject("msSqlServerInsertOrder", order);
    order.setOrderId(orderId.intValue());
    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);
    }