KickJava   Java API By Example, From Geeks To Geeks.

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


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 SqlMapAccountDAO extends SqlMapDaoTemplate implements AccountDAO {
10     
11     public SqlMapAccountDAO(DaoManager daoManager) {
12         super(daoManager);
13     }
14
15     public int insertAccount(Account account) {
16         try {
17             getSqlMapExecutor().insert("insertAccount", account);
18         } catch (SQLException JavaDoc e) {
19           throw new DaoException(e);
20         }
21         return 0;
22     }
23
24     public Account selectAccount(int accountId) {
25         try {
26             Account acc = (Account)getSqlMapExecutor().queryForObject("selectAccountById", new Integer JavaDoc(accountId));
27             return acc;
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