正如banq所说，decouple the relation between SB and JDBC. 这样对SB来说，它就是一个client, 它不需要也不应该知道Hibernate的各种opensession, session.save, update等明细操作。封在DAO的一个方法中，也就是抽象出一个大的接口， 以后Hibernate内部操作想变动对SB根本就没有冲击， 另外，Hibernate也有很多O/R Mapping的弱点，如批量删除，更新。我们可以直接换成JDBC的方法，封在DAO方法中，这样对SB永远都是透明的。其实好处也就是分层的思想。
Not Useful for Container-Managed Persistence Because the EJB container manages entity beans with container-managed persistence (CMP), the container automatically services all persistent storage access. Applications using container-managed entity beans do not need a DAO layer, since the application server transparently provides this functionality. However, DAOs are still useful when a combination of CMP (for entity beans) and BMP (for session beans, servlets) is required.
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.