CMP is persistance layer. The triditional well-known pattern used for j2ee applications is:
(jsp/servlet/pojos...)+ Business Delegator +Session Facade+ CMP/BMP + DB
here CMP/BMP is used for persistance.
As mentioned in Core J2ee patterns, if u change the persistance to DAO pattern. the framework is changed to:
(jsp/servlet/pojos...)+ Business Delegator +(Session Facade)+ DAO+ DB
Here u use JDBC inside DAO to deal the db operations.
about your question "有了CMP就不需要DAO,那是不是有了Hibernate就也不需要DAO了呢?"
The answer is "NO".
Why?
DAO could be a replacement of CMP. Hibernate is also a replacement of CMP but not a replacement of DAO.
For a CMP object, u have methods like create,remove, update, finder...
For DAO, u also have similiar methods like CMP does: create,remove, update, finder...
For Hibernate persistance object, u don't have methods like:create,remove, update, finder... . Instead, u have these operations in your domain objects(or session facade to be consistent with pervious framework). Therefore, u don't need DAO anymore at this point.
Let's go back to the origial topic. Why do we need CMP or DAO? the reason for that is to have a pluggable persistance layer(PPL) and a (PDB)pluggable DB. with PPL, u can easily change your PPL to another PPL(e.g. from CMP to DAO+JDBC, or from CMP to JDO, or to Hibernate). with PDB, u can easily move from Mysql to Oracle...
If u use Hibernate, u will have a pluggable DB automaticly(u can easily move from mssql to oracle). If u wanna have a pluggable persistance(e.g. move from Hibernate to JDO), u need need to implement it in DAO pattern.
Here is another question, do u really need a pluggable persistance layer?
I can't give an exact answer on this question. If u trust Hibernate and u are sure u won't change it to JDO or CMP in the furture, u don't need to have DAO. If u are considering change your persistance someday, it's better to have DAO.