Java Reference
In-Depth Information
}
C
Updates account
public int update(Account account) {
try {
getSession().save(account);
} catch (HibernateException e) {
log.error(e);
throw new DaoException(e);
}
return 1;
}
D
Deletes account
public int delete(Account account) {
try {
getSession().delete(account);
} catch (HibernateException e) {
log.error(e);
throw new DaoException(e);
}
return 1;
}
E
Deletes account
public int delete(Integer accountId) {
Account account = new Account();
account.setAccountId(accountId);
return delete(account);
}
F
Gets list of beans
public List<Account> getAccountListByExample(
Account acct) {
List accountList;
Session session = this.getSession();
Criteria criteria =
session.createCriteria(Account.class);
if (!nullOrEmpty(acct.getCity())) {
criteria.add(
Expression.like("city", acct.getCity())
);
}
If (!nullOrEmpty(acct.getAccountId())) {
criteria.add(
Expression.eq("accountId", acct.getAccountId())
);
}
try {
accountList = criteria.list();
} catch (HibernateException e) {
log.error(
"Exception getting list: " +
Search WWH ::




Custom Search