File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes DAO or  BMP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "DAO or  BMP " Watch "DAO or  BMP " New topic


punna Kumar
Ranch Hand

Joined: Feb 28, 2005
Posts: 80
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,
Gurumurthy Ramamurthy
Ranch Hand

Joined: Feb 13, 2003
Posts: 273
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.

I agree. Here's the link:
subject: DAO or BMP
It's not a secret anymore!