KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tctest > domain > SqlMapCustomerDAO


1 package com.tctest.domain;
2
3 import java.sql.SQLException JavaDoc;
4
5 import com.ibatis.dao.client.DaoException;
6 import com.ibatis.dao.client.DaoManager;
7 import com.ibatis.dao.client.template.SqlMapDaoTemplate;
8
9 public class SqlMapCustomerDAO extends SqlMapDaoTemplate implements CustomerDAO {
10     
11     public SqlMapCustomerDAO(DaoManager daoManager) {
12         super(daoManager);
13     }
14
15     public int insertCustomer(Customer customer) {
16         try {
17             getSqlMapExecutor().insert("insertCustomer", customer);
18         } catch (SQLException JavaDoc e) {
19           throw new DaoException(e);
20         }
21         return 0;
22     }
23
24     public Customer selectCustomer(int customerId) {
25         try {
26             Customer cus = (Customer)getSqlMapExecutor().queryForObject("selectCustomerById", new Integer JavaDoc(customerId));
27             return cus;
28         } catch (SQLException JavaDoc e) {
29           throw new DaoException(e);
30         }
31     }
32
33   public DaoManager getDaoManager() {
34     return daoManager;
35   }
36
37 }
38
Popular Tags