EJB design: CMP or BMP

  1. CMP or BMP (2 messages)

    i read the differences between CMP and BMP but i would like to know when it's better to use BMP rather than CMP.
    thank you

    Threaded Messages (2)

  2. CMP or BMP[ Go to top ]

    Download the free online book - Mastering EJB by Ed Roman from this website and it has good coverage on this topic.
  3. CMP or BMP[ Go to top ]

    Before introduction of EJB2.0 specification often developers used BMP rather than CMP because the previous EJB spec does not support enough important features like relationships. But EJB2.0 spec for CMP has good relationship support as well as performance improvements. <BR><BR>

    One of the CMP performance improvement technique in EJB2.0 is that the Container can monitor bean's data (in-memory buffer) change and if any changes happens in that data then only Container will update the database. Because of this monitoring capability, CMP gives better performance than BMP. And another technique is when you call finder method in BMP, it initially retrieves primary key with first call to the database and then instance data by placing a second call to the database. It makes two calls to the database. But CMP gets the data with single call to the database for the finder methods. Thus CMP gives better performance than BMP because Container has good hold on CMP.