I will make it more clear.
I wanna add the values of ResultSet to a HashMap.
users.put(string key, Object object);
- object is user object of User class : User (String username, String password, String[] roles)
When I checked user's login as below:
users.put("emchibiet", new User("emchibiet", "kiemchutchao", new String[] { ADMIN_ROLE }));
Then everything was alright.
But in reality, the values must come from database. Therefore, I did:
users.put(rs.getString(1), new User(rs.getString(2), rs.getString(3), new String[] { rs.getString(4) }));
It took no error. But Map named users that had no values. So the authenticate method returns empty and throw an exception.
I heard somewhre it must be converted ResultSet to Map.
Thanks!
bui-anh-khoa
|