Sometimes mapping tools have trouble with certain database schemas, especially overly complex ones. In those cases, BMPs are often the only choice. That was a common use a few years ago, especially when VisualAge for Java had trouble with even many to many relationships. Many of those problems have gone away.
Sometimes developers see opportunities for custom designs which might optimize data access, which normal CMP mapping wouldn't take advantage of. In those cases, you may see BMPs being used. Also, sometimes data isn't in a normal, relational database, which makes BMPs another options.
CMPs are typically easier to develop, easier to maintain, and easier to code (since they don't really have any code.) CMPs tend to create a more flexible and maintanable solution, which in typical scenarios, makes them a better choice, but of course, your mileage may vary.
Hi, I think discussion is going on wrong direction, Anthony has asked a simple question regarding CMP and BMP and rather than giving the answer, somebody is saying these tech are dead As per my best knowledge CMP gives you standard and not tightly coupled (i.e. you can changed database table/column name without changing the code) persistence way.It also requires less code as compared to BMP. But CMP also has some problem as far as select/create query are concern. Using CMP you can't load huge data like bib images into database and if you are using CMP than you have use QL for select statement, sometime some select clause is not supported by QL e.g. CMP 2.0 QL spec doesn't support COUNT, but these thing can vary container to container. BMP provides persistence way in which you can control the Tx as per your requirement but it is tightly coupled with your database structure. CMP also has home business method, which is light weight while BMP doesn't have home business methods. Hope that this will clear you when to use CMP and BMP.
Using CMP you can't load huge data like bib images into database and if you are using CMP than you have use QL for select statement, sometime some select clause is not supported by QL e.g. CMP 2.0 QL spec doesn't support COUNT, but these thing can vary container to container.
Why would anyone use EJB for loading images ? COUNT is supported in EJB 2.1.
Yes, there are a bunch of applications using EJB 2 BMP and CMP and they will live until venodors start desupporting it. I think there is a proposal to remove EJB 2 CMP from the next EJB / Java EE specifications. Typically new applications go live after 10-12 months after you start building it. So what I'm suggesting that you should not start developing new applications that you know is going away and avoid any maintainence problem associated with it.