Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB versus DAO

 
Mandy Tan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic