01: package com.tctest.domain;
02:
03: import java.sql.SQLException;
04:
05: import com.ibatis.dao.client.DaoException;
06: import com.ibatis.dao.client.DaoManager;
07: import com.ibatis.dao.client.template.SqlMapDaoTemplate;
08:
09: public class SqlMapCustomerDAO extends SqlMapDaoTemplate implements
10: CustomerDAO {
11:
12: public SqlMapCustomerDAO(DaoManager daoManager) {
13: super (daoManager);
14: }
15:
16: public int insertCustomer(Customer customer) {
17: try {
18: getSqlMapExecutor().insert("insertCustomer", customer);
19: } catch (SQLException e) {
20: throw new DaoException(e);
21: }
22: return 0;
23: }
24:
25: public Customer selectCustomer(int customerId) {
26: try {
27: Customer cus = (Customer) getSqlMapExecutor()
28: .queryForObject("selectCustomerById",
29: new Integer(customerId));
30: return cus;
31: } catch (SQLException e) {
32: throw new DaoException(e);
33: }
34: }
35:
36: public DaoManager getDaoManager() {
37: return daoManager;
38: }
39:
40: }
|