Best Practices

Before the introduction of EJB 2.0 specification, developers often used BMP rather than CMP because the previous EJB spec did not support important features such as relationships. But the EJB 2.0 spec for CMP has good relationship support as well as performance improvements.

One of the CMP performance improvement techniques in EJB 2.0 is that the container can monitor a bean's data (in-memory buffer) change. If any change happens in that data, only the container will update the database. Because of this monitoring capability, CMP gives better performance than BMP.

Another performance-limiting technique is when you call a finder method in BMP. It initially retrieves the primary key with the first call to the database, and then retrieves the instance data by placing a second call to the database—it makes two calls to the database. But for finder methods, CMP gets the data with a single call to the database. Thus, CMP gives better performance techniques than BMP because the container has a good hold on CMP.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.227.79.241