Tuesday, February 12, 2002 03:10 AM
You could have more than one reason for choosing BMP over CMP.
Some of them are listed below. However if you want to have a detailed study of each of the approaches, the pros & cons of them, then i would recommend the book Mastering EJB 2 by Ed Roman for reference.
BMP gives you ultimate control over JDBC, and thus you have unlimited flexibility for how you persist objects to the database. For CMP, many containers support complex mappings, but some containers don't!
If you have complicated queries across multiple tables with joins etc, BMP fits the bill.
Secondly debugging CMP code might be a lot more difficult coz you really don't know what is happening behind the scenes when error condition occurs.
Everything is controlled by the container for you.