• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

BMP x CMP

 
Gustavo Dutra
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

one more question about javacoding mock exam.....

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 .....

Any idea....
 
Yong How, Lim
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For CMP, the way they structure the SQL query is not "optimise" for that particular DBMS that you use.

Whereas BMP, the SQL are hand-crafted and you can use a very specialise SQL query that probably will squeeze every ounce of the performance for that DBMS that you have chosen.

Note a normally there is a slight advantage of BMP over CMP in term of performance, but when you consider that there is alot of usage of that EJB,
then these performance really adds up.

So if it is performance that you need, normally the advise would be to use BMP.
 
Rashmi Razdan
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yong,

Is it with both 2.0 and 1.1 ,I was under impression that with ejb2.o , CMP gives better performance, and also it can handle now complexities or relations as well.

thx,
Rashmi
 
Gustavo Dutra
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree,

look at this site:

http://www.precisejava.com/javaperf/j2ee/EJB.htm#EJB140

but the exam cover EJB 1.1 .... so...

I think Lim is correct.
 
Gurumurthy Ramamurthy
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Gustavo,

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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic