Originally posted by Deepa Malhotra: My understanding is that for EJB CMP, you dont need DAO. The container can take care of necessary stuff to talk to the database. it this correct?
Strictly speaking, DAO is a design pattern, and thus in no way comparable to entity beans. You could implement the DAO pattern with entity beans backing it up, or you could implement it with straight JDBC, or JDO, or by any other persistence API. The application code wouldn't see the difference, which is exactly the point in using the DAO pattern.
Originally posted by Deepa Malhotra: If so, what happens if I need to change the database?
If you're using CMP entity beans and your database needs to change, you need to update your entity bean code and deployment descriptors accordingly. Furthermore, if the modifications show to the application code, you need to update that as well.
DAO is used with BMP Entity Ejb.. only If U use CMP Entity and ur database changes I feel U need a change only in the deployment descriptor cos u dont have any access logic codes in ur cmp bean.Am i correct Lasse??? [ November 03, 2003: Message edited by: Bish Ach ]
if your j2ee system run in WLS or IBM's "where**"，you need not the pattren-- DAO. the JNDI pool and DataSource is "DAO".
Joined: Jan 23, 2002
Originally posted by Bish Ach: DAO is used with BMP Entity Ejb.. only
Usually, when DAO is used with EJBs, it's BMP entity beans. However, not always. One could just as well abstract data access away using the DAO pattern and "happen" to implement the operations with the help of the CMP engine...
Originally posted by Bish Ach: If U use CMP Entity and ur database changes I feel U need a change only in the deployment descriptor cos u dont have any access logic codes in ur cmp bean.Am i correct Lasse???