Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

CMP nad BMP  RSS feed

 
SUDA VIJAYA KUMAR
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Could anybody help me ,when I can use CMP'S and whn I can use
BMP'S.
I willbe grateful if anybody replies to my query
Thanks in advance
vijay
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi vijay,
It really hard to answer you question.
It depends on what you want to do, what can of performance you need, etc...
Some times it's faster if you write the JDBC code yourself, sometimes not. :-)
You can obtain a better explanation than mine from Sun : http://java.sun.com/j2ee/j2sdkee/techdocs/guides/ejb/html/Entity.fm.html#9339
And if you want a good book about EJBs, try Ed Roman's one
Mastering EJBs : http://www.theserverside.com/home/index.jsp

HTH.
 
Syed Basha
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To Explain, We can divided the Scenario in Two different way,
With Respect to the Database:
If we are going to query the Single defined database (oracle or db2 or somethingelse), we can go for the CMP otherwise we have to stick with BMP.
With Respect to the Code:
For CMP, as the container taking care of updating the Database, we dont have to specify any code implementation for the Load and Store methods of the bean implementation class.
For BMP, We have to have code with our Load and Store methods.

One more thing to add:
We have well defined Unit testing methods for CMP Bean, which makes our life easy.But not so for BMP.
Finally,
Its all depends on how we are going to do the job.
syed
 
Ragu Sivaraman
Ranch Hand
Posts: 464
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its more of a design question...
If the bean is more of off-the shelf type, you may wanna use a generic technology and non-propreitary api so that the bean is portable across all app-servers... BMP would be a better option as long there is no violation of j2ee spec..(like JNI access and stuff). Pitfall is laborious coding and many method implementations and transaction demarcation...
CMP is very useful if the beans are going to highly customized to the current application requirements, say for ex: banking application(highly secure and heavy transaction oriented). It would be ideal to use CMP and save lots of time and effort...
PS:
Some IT shops have multiple app-servers and the same ejb need to used in various app-server environment. For this scenario, you may wanna think about PCMP. pluggableCMP ex: Cocobase. These O/R mapping tool have support for various leading app-servers in the market and there by the portability can be achieved to a significant extent
HIH
Ragu

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!