• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EJB Stateless Session Bean with DAOs

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic