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