File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Using CMP and BMP together Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Using CMP and BMP together" Watch "Using CMP and BMP together" New topic
Author

Using CMP and BMP together

D Singh
Greenhorn

Joined: May 23, 2003
Posts: 10
Hi,
Could anybody please let me know if there could be any problems with using CMP's and BMP's together in a project.
Edy Yu
Ranch Hand

Joined: Nov 21, 2000
Posts: 264
Depending on your Application Server, the relationship between those beans could become harder to manage than pure CMP.

Just my two cents.


SCJP, SCJD, SCWCD, SCBCD, SCEA, IBM Certified Enterprise Developer, WebSphere Studio V5.0
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
CMP and BMP can definitely live together. In fact, it is preferred in those cases where you have a fairly old application based on BMP that you would like to move to CMP. Instead of doing it all in one shot it is better to take the change a little here, change a little there approach.
You should also be aware that BMP beans cannot participate in CMR (Container Managed Relationship), this is probably what Edy was referring to.
D Singh
Greenhorn

Joined: May 23, 2003
Posts: 10
Thanks Edy for a quick reply
We are using Websphere 4.0 and Oracle. We have to execute some stored procedures, for which I plan to use BMP's and for general simple database queries use CMP's. I hope this could be practically achieved without any issues or is there any alternative to this ?
Please suggest.
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Originally posted by D Singh:
Thanks Edy for a quick reply
We are using Websphere 4.0 and Oracle. We have to execute some stored procedures, for which I plan to use BMP's and for general simple database queries use CMP's. I hope this could be practically achieved without any issues or is there any alternative to this ?
Please suggest.

This solution would work fine. Though I would probably execute the stored procedures directly from the Session Bean layer. You are using Session Facades on top of your Entity Bean layer, right?
D Singh
Greenhorn

Joined: May 23, 2003
Posts: 10
Yeah Chris session bean would wrap entity beans.
I think you are right stored procedures should be executed through the controller which is the session bean, but my only concern is that if we have any complex queries to be executed the preferd way is to use BMP's (I think )as we are using EJB 1.1 architecture, could this cause any design or architectural problem as session bean would sometimes call CMP's and sometime BMP's ?
If there are any concerns how could we tackle them ?
Edy Yu
Ranch Hand

Joined: Nov 21, 2000
Posts: 264
There is no prefered way to execute complex data base quires. You could do that in BMP entity beans. You could do that in session beans also. In fact, if you do that in stateless session bean, the performance will be enhanced a lot and development will be much easier, given that you can live with the fact that session beans can not survive server crash.
In old days, EJB1.0 and even EJB 1.1, stateless session beans were the most popular EJBs selected by many projects because of the performance problem with entity and stateful session beans.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using CMP and BMP together