Design Question: Session vs. Entity Beans

M

MP

Quick Question:

For my web app I will be having a user login. Now I am wondering how I
should go about it.

1. JSP --> ActionServlet --> UserManager(session bean)
In this scase the UserManager session bean would do the appropriate
call to lookup the user information.

2. JSP --> ActionServlet --> UserManager(session bean) --> User
(entity bean)
Pretty much the same but the UserManager session bean would simply
validate the info supplied by the user and call the User entity bean
to do the lookup of the user id and password. The UserManager is
acting as the Facade for the entity bean User.

(The ActionServlet is Struts)

Thanks for your input.
 
B

Bryce (Work)

Quick Question:

For my web app I will be having a user login. Now I am wondering how I
should go about it.

1. JSP --> ActionServlet --> UserManager(session bean)
In this scase the UserManager session bean would do the appropriate
call to lookup the user information.

2. JSP --> ActionServlet --> UserManager(session bean) --> User
(entity bean)
Pretty much the same but the UserManager session bean would simply
validate the info supplied by the user and call the User entity bean
to do the lookup of the user id and password. The UserManager is
acting as the Facade for the entity bean User.

6 of one, half dozen the other.

Really depends on several things. I generally balance the benefits vs
complexity that EJBs add.

Does the benefits of creating a UserBean justify the complexity in
creating the interfaces and deployment descriptors? In my opinion, if
a simple JDBC call or JDO in your session bean suffices to do
authentication, then do that.

If the UserBean is an integral part of your business logic, and
requires heavy duty transactions, security, etc, then you might want
to use an EJB.
 
J

John C. Bollinger

MP said:
Quick Question:

For my web app I will be having a user login. Now I am wondering how I
should go about it.

1. JSP --> ActionServlet --> UserManager(session bean)
In this scase the UserManager session bean would do the appropriate
call to lookup the user information.

2. JSP --> ActionServlet --> UserManager(session bean) --> User
(entity bean)
Pretty much the same but the UserManager session bean would simply
validate the info supplied by the user and call the User entity bean
to do the lookup of the user id and password. The UserManager is
acting as the Facade for the entity bean User.

You should use whatever mechanism your application in general uses for
access to persistent data. If that mechanism is entity beans then (2),
otherwise (1). If your session bean wants to use the JDBC API, then it
should obtain the Connection(s) from a DataSource configured for and in
your application server.


John Bollinger
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top