File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Entity Beans must use CMP? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Entity Beans must use CMP?" Watch "Entity Beans must use CMP?" New topic

Entity Beans must use CMP?

Lu Battist
Ranch Hand

Joined: Feb 17, 2003
Posts: 104
I'm confused. I've heard the EJB 2.0 spec says you must use CMP for entity beans yet I keep reading about what a developer has to do if he is using BMP entity beans. Is it true, that the entity bean developer has a choice or must he always use CMP?
Anthony Watson
Ranch Hand

Joined: Sep 25, 2003
Posts: 327
You can use bean managed persistence with entity beans. You can NOT use bean managed transactions with entity beans.

Anthony W.<br />MCP, SCJP 1.4, SCJD, SCWCD 1.3, SCWCD 1.4, SCBCD
Namitha karupaiya
Ranch Hand

Joined: Mar 10, 2004
Posts: 89
Hello Anthony! I am confusing with "bean managed persistence" and "container managed transaction". May you explain a little more? Thank you.
Like Zhang

Joined: Jan 19, 2004
Posts: 16
data persistence is managed by bean...actually, defined by bean for CMP.
CMP let you define abstract method for getter and setter, but not the actual instance variable. The container will generate necessary code for database processing.
Whatever, you need to do something in your bean code even in CMP.
Transaction is defined in DD. I mean, you cannot define a method is in trasaction or not in your bean code, and you can only do that in DD.
Anthony Watson
Ranch Hand

Joined: Sep 25, 2003
Posts: 327
Persistence relates to how a bean gets data from the data source and saves data back to that source.
Transactions are statements that succeed or fail as an atomic unit.
Consider Paul's rocket mass heater.
subject: Entity Beans must use CMP?
It's not a secret anymore!