public User getUser(String username) {
    con = new DBConnection();
    User objUser = null;
    try {

      cstmt = con.connection.prepareCall("{call getUser(?)}");
      cstmt.setString(1, username);
      ResultSet rsUser = cstmt.executeQuery();

      if (rsUser.next()) {
        objUser = new User();
        objUser.setUserName(rsUser.getString("UserName"));
        objUser.setPassword(rsUser.getString("Password"));
        UserRole objUserRole = new UserRole();
        objUserRole.setRole(rsUser.getString("Role"));
        objUser.setUsertype(objUserRole);
      }

    } catch (Exception e) {
      e.getMessage();
    } finally {
      con.closeConnection();
    }
    return objUser;
  }
Exemple #2
0
  public UserRole removeUserRole(UserRole userRole) {
    getUserRoles().remove(userRole);
    userRole.setRole(null);

    return userRole;
  }
Exemple #3
0
  public UserRole addUserRole(UserRole userRole) {
    getUserRoles().add(userRole);
    userRole.setRole(this);

    return userRole;
  }