Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Design Question using EJB3.0

 
PavanPL KalyanK
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my servlet



This is my Remote interface



This is my SessionBean class where i directly implemented the logic



Now my question is it a good pratice to directly implement the logic inside the SessionBean .

I want to ask what is the general approach followed where we need to contact the DataBase for some operations .Please help.

waiting for your suggestions.
 
PavanPL KalyanK
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is my question vague ??
 
Reza Rahman
author
Ranch Hand
Posts: 580
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pavan,

This is a question that most EJB 3/Java EE 5 references cover in detail (EJB 3 in Action certainly does). As a brief summary, the choice is really up to you. You can put business logic in session beans while using a separate DAO layer to encapsulate persistence code. This is the traditional Java EE layered architecture. If you wish, you can omit the DAO layer while using JPA. Some folks have argued that JPA makes the DAO layer obsolete. You can also use domain driven design (DDD) and put business logic in domain objects that are invoked by session beans.

Hope it helps,
Reza
 
PavanPL KalyanK
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Reza , thanks for your excellent explanation
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic