コード例 #1
0
  public AssociatedAccount findAssociatedAccount(AssociatedAccount assAccount) throws DAOException {
    String hql = "from AssociatedAccount where serialNumber=? and userName=?";
    Object[] params = {assAccount.getSerialNumber(), assAccount.getUserName()};
    @SuppressWarnings("unchecked")
    List<AssociatedAccount> list = super.getHibernateTemplate().find(hql, params);

    if (!list.isEmpty()) {
      return list.get(0);
    }
    return null;
  }
コード例 #2
0
  public void updateAssociatedAccount(String userName, String password) throws DAOException {

    String hql = "from AssociatedAccount where userName=? ";
    Object[] params = {userName};
    @SuppressWarnings("unchecked")
    List<AssociatedAccount> list = super.getHibernateTemplate().find(hql, params);
    @SuppressWarnings("rawtypes")
    Iterator ite = list.iterator();
    while (ite.hasNext()) {
      AssociatedAccount assAccount = (AssociatedAccount) ite.next();
      assAccount.setPassword(password);
      super.getHibernateTemplate().update(assAccount);
    }
  }