📄 accountdaoimpl.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -