GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  J2EE  >  EJB
Go To First  |  Previous Question  |  Next Question 
 EJB  |  Question 11 of 175    Print  
What is the difference between CMP and BMP

Answered by Jey on 2005-05-08 11:32:16:

CMP means Container Managed Persistence. When we write CMP bean , we dont need to write any JDBC code to connect to Database. The container will take care of connection our enitty beans fields with database. The Container manages the persistence of the bean. Absolutely no database access code is written inside the bean class.  

BMP means Bean Managed Persistence. When we write BMP bean, it is programmer responsiblity to write JDBC code to connect to Database.




  
Total Answers and Comments: 5 Last Update: February 08, 2006   
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: Jey
 
CMP means Container Managed Persistence. When we write CMP bean , we dont need to write any JDBC code to connect to Database. The container will take care of connection our enitty beans fields with database. The Container manages the persistence of the bean. Absolutely no database access code is written inside the bean class.  
BMP means Bean Managed Persistence. When we write BMP bean, it is programmer responsiblity to write JDBC code to connect to Database.

Above answer was rated as good by the following members:
phdsong
May 08, 2005 11:32:16   #1  
Jey        

RE: What is the difference between CMP and BMP
CMP means Container Managed Persistence. When we write CMP bean , we dont need to write any JDBC code to connect to Database. The container will take care of connection our enitty beans fields with database. The Container manages the persistence of the bean. Absolutely no database access code is written inside the bean class.  
BMP means Bean Managed Persistence. When we write BMP bean, it is programmer responsiblity to write JDBC code to connect to Database.

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
July 25, 2005 02:36:13   #2  
Ritesh Patni        

RE: What is the difference between CMP and BMP
CMP -- Container-managed persistence beans are the simplest for the bean developer to create and the most difficult for the EJB server to support. This is because all the logic for synchronizing the bean's state with the database is handled automatically by the container. This means that the bean developer doesn't need to write any data access logic, while the EJB server is supposed to take care of all the persistence needs automatically. With CMP, the container manages the persistence of the entity bean. Vendor tools are used to map the entity fields to the database and absolutely no database access code is written in the bean class 
 
BMP--bean-managed persistence (BMP) enterprise bean manages synchronizing its state with the database as directed by the container. The bean uses a database API to read and write its fields to the database, but the container tells it when to do each synchronization operation and manages the transactions for the bean automatically. Bean-managed persistence gives the bean developer the flexibility to perform persistence operations that are too complicated for the container or to use a data source that is not supported by the container.

 
Is this answer useful? Yes | No
October 04, 2005 07:55:38   #3  
suman medisetti        

RE: What is the difference between CMP and BMP

The differences between CMP and BMP are

In CMP :no findByPrimaryKey() method,ejbCreate method returns null in bean implimentation,Container responsible for database connections and transactions,Container takes care of implimenting ejbStore and ejbLoad method.No complex queries like joins are handled by container,3 deployment descriptors files are needed.

In BMP :findByPrimaryKey method is implimented,ejbCreate method returns primarykey class type,developer responsible for database connections,Developer should take care of implimenting ejbStore and ejbLoad methods,2 deployment descriptors files are needed.


 
Is this answer useful? Yes | No
November 01, 2005 16:49:26   #4  
Anitha        

RE: What is the difference between CMP and BMP
CMP : When a bean instance is created, the container retrieves the data from the db or persistant storage and assigns it to the object vars of the bean for the user to manipulate or use them. For this, we need to map the fields of the database to the fields in the deployment descriptor.BMP : Whenever the bean instance is created, it is the responsibility of the developer to make the connection to the database, retrieve the values, assaign it to the object variables in ejbload() method of the bean instance. similarly ejbstore() method is used to save the values from the bean to the database.The advantage of using the entity beans (EJB) is the activities such as management of database transactions, connection pooling,etc are taken care by the ejb container.
 
Is this answer useful? Yes | No
February 07, 2006 23:01:35   #5  
Debabrata Sau        

RE: What is the difference between CMP and BMP
CMP means Container Managed Persistence. In case of CMP bean , developers dont need to write any JDBC code to connect to Database. The container will take care of connection our enitty beans fields with database. The Container manages the persistence of the bean. Absolutely no database access code is written inside the bean class.  

BMP means Bean Managed Persistence. In case of BMP bean, it is programmer responsiblity to write JDBC code to connect to Database.

For CMP beans you can map only one table at a time. But for BMP u can map more that one table at a time.

CMP bean is easy for developers but dificult tounderstand to container. So u cant execute complex query in CMP bean.


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape