*
The moose likes EJB and other Java EE Technologies and the fly likes EJB Stateless Session Bean with DAOs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB Stateless Session Bean with DAOs" Watch "EJB Stateless Session Bean with DAOs" New topic
Author

EJB Stateless Session Bean with DAOs

Andrew Burger
Greenhorn

Joined: Mar 22, 2007
Posts: 3
I am wondering the pros and cons of each way to implement a Stateless Session Bean with DAO objects. If there is a another way then these that is better, please let me know.




or



[ March 22, 2007: Message edited by: Andrew Burger ]
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

My recommendation is always to not do stuff in the stateless session bean directly. Add another layer between your EJBs and the DOA layer. Make POJO classes that actually implement you business logic, then have your EJB create an instance of these POJO Service classes and call a method in it. Then in that POJO class is where you create instances of your DAO through a DAOFactory.

This allows the reuse of the service POJO Use Case object for other services that might need the same code, and takes out the need for these other services to do a local or remote lookup of the EJB that has that code. Plus you can test these POJOs outside of the container.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB Stateless Session Bean with DAOs
 
Similar Threads
EJB Timer issue
ejb create() Error java.lang. IllegalStateEx: Failed to find method for hash
a session bean contacts an entity bean
Using a regular bean in a statefull Session bean
Help in stateless and stateful beans ( VAJ )