aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Design Question using EJB3.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Design Question using EJB3.0" Watch "Design Question using EJB3.0" New topic
Author

Design Question using EJB3.0

PavanPL KalyanK
Ranch Hand

Joined: Feb 28, 2009
Posts: 212
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

Joined: Feb 28, 2009
Posts: 212
Is my question vague ??
Reza Rahman
author
Ranch Hand

Joined: Feb 01, 2005
Posts: 580
    
    5
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


Independent Consultant — Author, EJB 3 in Action — Expert Group Member, Java EE 6 and EJB 3.1
PavanPL KalyanK
Ranch Hand

Joined: Feb 28, 2009
Posts: 212
Reza , thanks for your excellent explanation
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Design Question using EJB3.0