id_user: 1
username(var): root
password(var): root
role(int): 1
department(int): 1
id_role: 1
role: admin
id_department: 1
department: all
select role from users where username="root" and password = "root";
role = session.createQuery("Какой запрос сюда ставить?").toString();
SELECT role.role FROM users LEFT JOIN role ON users.role=role.id WHERE users.username="root" AND users.password = "root";
Должно сработать.