aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes  Data access from Servlet / SLSB / SFSB/ Entity Bean ?! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark " Data access from Servlet / SLSB / SFSB/ Entity Bean ?!" Watch " Data access from Servlet / SLSB / SFSB/ Entity Bean ?!" New topic
Author

Data access from Servlet / SLSB / SFSB/ Entity Bean ?!

Alagapan Thiagarajan
Greenhorn

Joined: May 31, 2001
Posts: 9
Dear friends,
After learning about all the J2EE technolgies i am still sort of confused reg where to put my database access code. what is the best approach.. ? What are the guidelines & best practices ?
When do i do it from Servlets + DAO ?
When do i use a Stateless Session Bean to do it ?
When do i use a Statefull Session Bean to do it ?
When do i use a Entity Bean to do it ?
Plz help me understand.
Thank you very much
Regards
Alags
Dan Malks
Author
Greenhorn

Joined: Jul 21, 2003
Posts: 10
Hi,
In our book, Core J2EE Patterns, we touch on these issues as part of several patterns, and as part of our J2EE refactoring section. We include a visual to support each refactoring in the book and in this case show the following sorts of structures:
Servlet/JSP --> DAO
Servlet/JSP --> Business Delegate --> Session Beans --> DAO
Servlet/JSP --> Business Delegate --> Session Beans -----------------------\
*thisrepresentswhitespace* \__________\______Entity Beans (BMP only)-------> DAO
We'll be updating this refactoring to include the Application Service pattern and others in the future.
Btw, the diagram is a bit more polished in final form. ;-)
Hope this helps.
[ December 02, 2003: Message edited by: Dan Malks ]
[ December 02, 2003: Message edited by: Dan Malks ]
[ December 02, 2003: Message edited by: Dan Malks ]

<i><b>- Dan Malks</b></i><br />Co-Author of <a href="http://www.corej2eepatterns.com" target="_blank" rel="nofollow">Core J2EE Patterns: Best Practices and Design Strategis</a>
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Very impressive Ascii art, Dan!

Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
 
Consider Paul's rocket mass heater.
 
subject: Data access from Servlet / SLSB / SFSB/ Entity Bean ?!