public Integer add(String host, String username, String password) { MailAccount account = new MailAccount(); account.setHost(host); account.setUsername(username); account.setPassword(password); return HibernateUtils.save(account); }
public void update(Integer id, String host, String password) { MailAccount account = getInstance(id); if (account != null) { account.setHost(host); account.setPassword(password); HibernateUtils.update(account); } }
public MailAccount getInstance(Integer id) { return HibernateUtils.get(MailAccount.class, id); }