• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Entity beans BMP and CMP

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
Can some one please explain for Entity beans where to use BMP and where to use CMP and why.I am new to EJB so will be very thankfull if some one can explain in detail.
Thanks in advance
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Aamir,
Regarding your doubt about BMP and CMP I hope this helps you:
1.)Bean Managed Persistence is selected under cases where the complexity of queries with the backend is more where you would like to handle the JDBC/SQL operations on your own.
2.)Container Managed Persistence is used when we go for simple lookup operations in database.
Thus in BMP its you who will have to manage everything but in CMP its as follows:
The CMP entity beans allows the container to handle some or all of its data access logic.Rather than coding JDBC/SQL operations in your bean class ,your container implicitly performs all database operations behind the scenes.
With CMP ,you must make some of your entity bean class's fields public so that the container can set the fields when it performs database operations on behalf of your bean.
Thus CMP handles everything on your behalf(such as Transaction Management,Database connection pooling,security etc,).
Well its vast to explain this ...but hope this gives you some idea and if any more info you are always welcomed.
Rgds,
Poornima.

 
Aamir Khan
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply Poornima, need a little more explanation.
With CMP ,we can only do the simple db queries like insert, delet etc or can also do something like stored procedures? How the container will know that we are using CMP or BMP? (we have to explain this in deployment descripter I think, am I right?)
Thanks again
Aamir
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Amir,
Hope, the following explanation would clarify some of your questions.
First, you are right when you said that you specify in deployment descripter whether the bean is a CMP or BMP.
Deploying, and the usasge of CMP is verymuch tied to the vendor of the Container. I am not aware of any Application servers that support Stored Procedures for CMP beans.
 
Don't play dumb with me! But you can try this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic