aspose file tools*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Relationship between CMP and BMP entity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Relationship between CMP and BMP entity" Watch "Relationship between CMP and BMP entity" New topic
Author

Relationship between CMP and BMP entity

Erik Brakkee
Ranch Hand

Joined: Jun 21, 2004
Posts: 40
Hi,


I have been reading about CMR and there is one question I could not find an explicit answer to and this is how to support relations between CMP and BMP entity beans. As I can see it there are no restrictions here so any of the following is possible:
1. a uni-directional relation from a CMP to a BMP entity bean
2. a uni-directional relation from a BMP to a CMP entity bean
3. a bi-directional relation between a CMP and BMP entity bean
Of course, also in all variants: one-to-one, one-to-many, many-to-one, many-to-many.

Can anyone confirm this?

Cheers
Erik


SCJP, SCJD, SCWCD, SCBCD
Karimulla Shaik
Greenhorn

Joined: Sep 28, 2005
Posts: 17
Originally posted by Erik:
Hi,


I have been reading about CMR and there is one question I could not find an explicit answer to and this is how to support relations between CMP and BMP entity beans. As I can see it there are no restrictions here so any of the following is possible:
1. a uni-directional relation from a CMP to a BMP entity bean
2. a uni-directional relation from a BMP to a CMP entity bean
3. a bi-directional relation between a CMP and BMP entity bean
Of course, also in all variants: one-to-one, one-to-many, many-to-one, many-to-many.

Can anyone confirm this?

Cheers
Erik



Hi Erik,

I am not sure from where you have read that any type of relationship ( 1->1 or 1->many or Many->Many) between BMP and CMP is possible.

EJB specification clearly says that relationships between entity beans can be managed (Transparently) by the Container ONLY when the persistence is Container Managed. This would provide the visibility to the Container to understand how the tables of the entity beans involved in relationships, mapped at the database end , by which it can transparently manage the relationships.


You can certainly have one or more BMP entity beans as a instance variable of CMP bean and vice versa but you will not be able to get the transparent relationship management ( For ex: when a child entity bean is added/deleted - adding or deleting it at the database end) provided by the Container as Container will not have the visibility to the BMP bean and the table it is mapped to( Note that all the Persitence code has to be written inside the bean itself).

Please read the section "10.3.2 The Entity Bean Provider´┐Żs View of Persistent Relationships" for more details on the entity bean relationship.

Regards
Karim
Erik Brakkee
Ranch Hand

Joined: Jun 21, 2004
Posts: 40
Hi Karim,


I didn't actually read anywhere that this was possible, but could find any place that said it wasn't. Anyway, your reply clarifies a lot.

Thanks
Erik
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Relationship between CMP and BMP entity