accountdaoimpl.java
来自「用mysql和jdbc servlet 写银行管理系统」· Java 代码 · 共 41 行
JAVA
41 行
package com.tarena.ebank.persist;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import com.tarena.ebank.biz.Account;
public class AccountDAOImpl implements AccountDAO {
public void del(String actNo, Session s) throws DataException {
s.delete(this.findAccountByActNo(actNo, s));
}
public Account findAccountByActNo(String actNo, Session s)
throws DataException {
Account a=null;
try {
String hql="from Account a "+"where a.actNo=?";
a=(Account)s.createQuery(hql).setString(0, actNo).uniqueResult();
} catch (HibernateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw new DataException("find error");
}
return a;
}
public void insert(Account act, Session s) throws DataException {
s.saveOrUpdate(act);
}
public void update(Account act, Session s) throws DataException {
insert(act,s);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?