This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes cmp vs bmp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "cmp vs bmp" Watch "cmp vs bmp" New topic
Author

cmp vs bmp

vara prasad
Ranch Hand

Joined: Dec 21, 2004
Posts: 47
sir
1)please tell me what is the
difference between cmp and bmp
clearly. i read to many books so that i m now in confused
where exatly we can differ cmp and bmp.
if you can tell me but not give me other sources t o read
if i read those things i will confused more. so please
clearly give the differenses

2)if we put jdbc code in bmp`s pasivating method what will hapen?

thank you
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30050
    
149

Vara,
CMP is container managed persistence. This means the the EJB container handles all the database stuff for you. BMP is bean managed persistence where you have to write the code yourself.

CMP is much more common than BMP. If you have to write the code yourself, you often are better off using an object/relational mapping framework or even pure JDBC.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
Hi Vara,


2)if we put jdbc code in bmp`s pasivating method what will hapen?

Right from the top you must notice that the container saves the bean�s state into the database before passivation, calling the ejbStore(). Hence there is no reason for you to provide any database code in ejbPassivate(). However by doing so, your jdbc code will execute in a very unpredictable manner, because you have no way to control the way your container passivates/activates the bean. Hence from a design standpoint you cannot implement any business logic inside of ejbPassivate(), because you�ll never know when this logic will execute, if it will execute at all (although almost certainly ejbPassivate/ejbActivate will be called at least once in a bean life cycle).
Bottom line is that if you ever considered implementing jdbc logic inside of ejbPassivate I can recommend you only one thing: please stay away.
Regards.


I think, therefore I exist -- Rene Descartes
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cmp vs bmp
 
Similar Threads
CMP and BMP
BMP question
inserting null values in the backend using enterprise beans
CMP Vs BMP Which one is better
Please justify about EJB