• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Its not necessary to use SLSB, or is it?

 
aditee sharma
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A read only object like a Catalog, may not require a Session Bean. Why can't I just call a DAO from the Servlet ?
Are there any advantages that using a SLSB would give over a Servlet for read only data ?
 
deepak adlakha
Ranch Hand
Posts: 325
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my personal opinion, It all depends on the architecture/context of the application.

Like if you application is not using EJB's at all, then just to read the data from database, i wont recommend using SLSB for this job. But if application already has EJB's and some different interactions are also required with some other systems, then we can use SLSB.
 
aditee sharma
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
deepak adlakha wrote:In my personal opinion, It all depends on the architecture/context of the application.

Like if you application is not using EJB's at all, then just to read the data from database, i wont recommend using SLSB for this job. But if application already has EJB's and some different interactions are also required with some other systems, then we can use SLSB.


Even if I am using EJBs in other areas like persisting the data, how does it matter during a read operation that whether or not I use SLSB as far as my read operation is isolated from any external interface ?
Is there a reason I can't use Presentation + Servlet + DAO instead of Presentation + Servlet + SLSB + DAO ?
In fact, adding another layer can possibly slow down the application, no ?
 
deepak adlakha
Ranch Hand
Posts: 325
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you can use Presentation + Servlet + DAO.

But I think as Servlet as one of the client for next Layer/Tier.

In Presentation + Servlet + SLSB + DAO. Advantage which i see is if tomorrow if you have one more client(say some other EJB component or web service) besides servlet for SLSB, then your DAO is not directly exposed to the client.

But in case of Presentation + Servlet + DAO. if new client is added then you may need to expose your DAO directly.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic