| 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: 559
|
|
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
|
 |
 |
|
|
subject: Design Question using EJB3.0
|
|
|