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?
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.
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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.