When should I adopt BMP and when I should use CMP? Can I use both of them?

Alessandro A. Garbagnati

Well, the quick answer to your second question is "Yes". You can use CMP and BMP beans in the same application... obviously, a bean can be BMP or CMP, not both at the same time (they are mutually exclusive).

The answer to your first question cannot be easy at all. There are so many players in the game that is almost impossible provides a complete and always-valid answer.

As somebody else has said in some threads or other FAQs (i.e.: Should I use CMP or BMP for an application with complex data manipulation & relations>) there is a common approach that is normally used and considered a good one.
You should start developing CMP beans, unless you require some kind of special bean, like multi-tables, that cannot be completely realized with a single bean.
Then, when you realize that you need something more or that you would prefer handling the persistence (performanbce issue are the most common reason), you can change the bean from a CMP to a BMP.

Take also a look to this faq: Is there a difference between container managed and bean managed persistence in terms of performance?
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact