It's not a secret anymore!*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes EJB versus DAO Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "EJB versus DAO" Watch "EJB versus DAO" New topic
Author

EJB versus DAO

Mandy Tan
Greenhorn

Joined: Aug 09, 2006
Posts: 6
Hi

I am attempting the 2nd part of the assignment. I have a question regarding the EJB and DAO. From what i understand, DAO is a OO-pattern, so do we use DAO when we want a persistence layer without EJB and we write our own JDBC and sql code to access the database.

Or is entity bean still required ? then where does the DAO come in ?

Appreciate any clarification.

thanks & rgds
Mandy Tan
Juha Karemo
Greenhorn

Joined: Aug 09, 2006
Posts: 1
Hi!

DAO is used to abstract the data access to the persistence layer. This frees the client of DAO layer from knowing any implementation specific details, like using EJB or not. The decision to use DAO doesn't dictate that you must use JDBC to implement it. You are free to choose any implementation technology (for example EJB, Hibernate, JDBC) you find appropriate.

+Juha
Mandy Tan
Greenhorn

Joined: Aug 09, 2006
Posts: 6
Hi

So if i intend to use DAO inside my sequence diagram, I need only show the DAO and not EJB ? Cos the DAO encapsulate the db access logic, and we are free to use EJB or hibernate in our implementation.

The assignment says it has to be J2EE compliant, but right now my sequence diagram only shows JSP/servlet, session beans and DAO. No Entity Beans yet, so i am not sure whether this will be truly J2EE compliant.

Appreciate any advice.

Thanks & rgds
Mandy
 
 
subject: EJB versus DAO