Advertisement
Guest User

Untitled

a guest
May 25th, 2018
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. public Account login(Account account){
  2.         try{
  3.             ResultSet rs = database.executeQuery(
  4.                     "select * from accounts" +
  5.                     " where username ='" + account.getUsename() + "' and"+
  6.                     " password ='"+ account.getPassword() + "'" +
  7.                     " limit 1"
  8.             );
  9.            
  10.            
  11.             if (!rs.last()) {
  12.                 return null;
  13.             }else{
  14.                 account.setPerson(person.findBy("id", rs.getInt("person_id") + ""));
  15.                 account.setRole(role.findBy("id", rs.getInt("role_id") + ""));
  16.                 account.setId(rs.getInt("id"));
  17.                 account.setState(rs.getInt("state"));
  18.             }
  19.         }
  20.         catch(Exception e){
  21.             System.out.println(e);
  22.             return null;
  23.         }
  24.        
  25.         return account;
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement