• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DAO or BMP

 
punna Kumar
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys,
i have a small dought regarding DAo and Entity Beans,

1)When ur going for DAO and When u r going for Entity beans,
2)What is the advantages of DAO instated of Entity bean(BMP)


plz help me.........

Thanks & Ragards,
Punna
 
Gurumurthy Ramamurthy
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. EJB is heavy weight and DAO is light weight.
2. If there is an absolute need for EJB (like sharing data, transactional, bean pooling), then EJB is a better choice. But just for the sake of DB access, don't go for EJB, instead you can use DAO (Data ACcess Object)
3. DAO is a pattern that embodies the typical JDBC code inside, and you can use it like plug-and-play mechanism, meaning that this would be a separate class file that can be called by your servlets/action classes or other classes which does the business logic.
4. Advantage is whenever you would like to for Entity Beans in future (espeically for CMP), then you can better use DAO, since DAO can be replaced with CMP (since CMP does not have any Database coding inside, only BMP has got)
5. This DAO can be treated separately; like it promotes the loose coupling; all database related coding (like change of DB, change of tables, change of schema...) could be done in DAO without affect the other parts.

Thanks,
Guru
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic