Jerson Chua wrote:

> Hello....
> I'm currently designing a web application.  The admin module is assigned to me so 
>there's
> this scenario where the administrator can retrieve and update a user profile. I'm
> planning to design it in a way where the retrieving of the user profile is through a 
>data
> access object, which directly access the database and returns a value object that
> represents the user profile. The rationale for such design is because retrieving user
> profile entity bean is not efficient since it will only be used for displaying 
>purposes
> only.  On the other hand, for updating the user profile, the servlet will retrieve 
>the
> entity bean and update it through the setter methods.  My question is "Is this the 
>right
> way of doing it cause I think it's kind of inconsistent" or "Should I also use the 
>entity
> bean for displaying the user profile?"
>

It depends on the AppServer and on your design.
First, you should use a facade session bean, or at least a coarse-grained 
getUserDetails()
method in your entity bean (or better: both). This will make sure that you only load 
the bean
once.
Second, you should look at your AppServer documentation to see if it's able to detect 
that a
method was read-only, to avoid the unnecessary storage of the state in the DB after the
getDetails call. Some do that automatically, some do that thanks to a flag in the DD, 
some
require an isModified method.
Finally, if you plan to display the details of a large number of users, you'd better 
choose
an AppServer that's able to load the state and instantiate the beans within a 
multi-finder
call (IAS can do that).
If your AppServer is powerful enough, I would use CMP entity beans instead of direct DB
access.

JB.

>
> I got this idea where the web tier directly accesses the database in the Pet Store
> Example (The Catalog). But the difference is that the system doesn't update the 
>catalog.
>
> Please guide me.
>
> thanks in advance...
> Jerson
>
> __________________________________________________
> Do You Yahoo!?
> Get Yahoo! Mail � Free email you can access from anywhere!
> http://mail.yahoo.com/
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".

--
Jean-Baptiste Nizet
[EMAIL PROTECTED]

R&D Engineer, S1 Belgium
Kleine Kloosterstraat, 23
B-1932 Sint-Stevens Woluwe
+32 2 200 45 42

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to