Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what is Container-managed persistence (CMP) for entity beans

 
reshu goyal
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anyone explain me what is meant by
Container-managed persistence (CMP) for entity beans
 
Greg Charles
Sheriff
Posts: 3002
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An entity bean is a representation of data, usually stored in a single record of a single table of a relational database. It can perform normal database CRUD (create, remove, update, and delete) operations, as well as "finder" operations. BMP entity beans have these operations coded into the bean class, usually using JDBC. CMP entity bean let the container do this work, using hints the bean provider and assembler put into the deployment descriptor.

I hope that's clear. Generally speaking, you're going to get better response on Java Ranch with more specific questions. If you're interested in learning basic concepts, I recommend getting a copy of Heads First EJB or any other book, or perusing online tutorials. Good luck!
 
Saagar Kappa
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Reshu,

I guess you are in teh starting stages. this is the simplest way i could explain that...

Persistent Store is something like a databse usually..

CMP stands for Container managed persistence which means the calls to teh database are managed by the Container. The entity beans are used to access the data something like customer name, address and id stored in a database table. To get access to teh database u need a connection rite. Usually with BMP u use the JDBC(Java Database Connectivity) commands. But with CMP the calls related to the connections for the database are all handled by the container..

In simple words, Entity beans are used to get the data from the database and the connections to the database (persistence) are all handled by the Container in CMP... Whenever u see persistent store replace it mentally with database and u wud find it easier..

Cheers,
Saagar.
 
Arun
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adding more to the posts earlier note that, with BMP you still get the connection from the container and the container manages the connections. Also, things like when a bean has to be stored or retrieved from the database are the same for CMP and BMP. The difference is that in BMOP you write the queries that need to be executed for doing the CRUD operations. With CMP the container generates the queries for you.
 
Arun
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adding more to the posts earlier note that, with BMP you still get the connection from the container and the container manages the connections. Also, things like when a bean has to be stored or retrieved from the database are the same for CMP and BMP. The difference is that in BMOP you write the queries that need to be executed for doing the CRUD operations. With CMP the container generates the queries for you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic