I have a simple authorization page which intends the user to type login and password. Based on the results of user input, I define the next page to display. I have a table in db that contains id, user's login and password, and user's role, so the next page will be defined based on information that will be retrieved from the role field of the record which corresponds to inputed login and pass. But also I have a table in db which contains all of the user's info(about 10 fields) of one type of users and another table which contains info about another type of users(4 fields). So my db has such a structure:
Table 1:
id
login
pass
role
Table 2:
id(reference to id of table 1)
other fields....
Table 3:
id(reference to id of table 1)
other info....
I think that my app has to have a managed bean(requestScope) for authorization that will take login and password. That bean will have an action controller for submitting authorization form. In that action controller I have to determine the role of user and based on that information create a session scoped managed bean for concrete type of user(app will have separate managed bean for different types of users). Also I have in that action controller to pass specific info for instatiation the session scoped bean for user(id of user). But can I simply instatiate a session scope managed bean(with help of new operator) in action method of request scope managed bean? Also how can I use methods of one session scoped bean in another session scoped bean(Suppose I create 2 session scoped managed beans which are responsible for different services, how can i call method of one in another).
Maybe the described method isn't good for such a problem? If so can you give an advise for better design approach?