01: /**
02: * User: Clinton Begin Date: Jul 13, 2003 Time: 7:20:13 PM
03: */package com.ibatis.jpetstore.persistence.sqlmapdao;
04:
05: import java.util.List;
06:
07: import com.ibatis.dao.client.DaoManager;
08: import com.ibatis.jpetstore.domain.Account;
09: import com.ibatis.jpetstore.persistence.iface.AccountDao;
10:
11: public class AccountSqlMapDao extends BaseSqlMapDao implements
12: AccountDao {
13:
14: public AccountSqlMapDao(DaoManager daoManager) {
15: super (daoManager);
16: }
17:
18: public Account getAccount(String username) {
19: return (Account) queryForObject("getAccountByUsername",
20: username);
21: }
22:
23: public List getUsernameList() {
24: return queryForList("getUsernameList", null);
25: }
26:
27: public Account getAccount(String username, String password) {
28: Account account = new Account();
29: account.setUsername(username);
30: account.setPassword(password);
31: return (Account) queryForObject(
32: "getAccountByUsernameAndPassword", account);
33: }
34:
35: public void insertAccount(Account account) {
36: update("insertAccount", account);
37: update("insertProfile", account);
38: update("insertSignon", account);
39: }
40:
41: public void updateAccount(Account account) {
42: update("updateAccount", account);
43: update("updateProfile", account);
44:
45: if (account.getPassword() != null
46: && account.getPassword().length() > 0) {
47: update("updateSignon", account);
48: }
49: }
50:
51: }
|