QUESTION : What considerations make sense when writing an entity bean?
a) Use BMP when storing standard datatypes and performance is essential (CORRECT) ???
b) Use BMP when storing standard datatypes and performance is not essential
c) Use BMP when storing complex datatypes and performance is essential (ANSWERED) (CORRECT)
d) Use BMP when storing complex datatypes and performance is not essential (ANSWERED) (CORRECT)
SOLUTION: BMP can easily be used to store complex datatypes (in contrast to CMP), it's performance depends partially on the bean programmer's work
Well, every article that I read on internet said CMP improve performance using cache and another features implemented by the container. The articles said programmers have to be dba's to create betters queries than the container...
I agree with the problems about complex types, but performance .....
I agree to you. BMP is faster or CMP is faster??? confusing....
Use CMP instead of BMP
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.
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.
Ever since I found this suit I've felt strange new needs. And a tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database